summaryrefslogtreecommitdiff
path: root/src/checkpath/checkpath.c
AgeCommit message (Collapse)Author
2025-11-13checkpath: allow -W with -f, -d, -pAnna (navi) Figueiredo Gomes
check for writtability after the open attempt, and still creating the file beforehand if it doesn't exist
2025-11-13checkpath: don't break the format stringAnna (navi) Figueiredo Gomes
2025-11-13checkpath: use goto errAnna (navi) Figueiredo Gomes
2025-11-13checkpath: use mkfifoatAnna (navi) Figueiredo Gomes
2025-11-13checkpath: factor openat call out of switchAnna (navi) Figueiredo Gomes
2025-11-13checkpath: split out create code into a functionAnna (navi) Figueiredo Gomes
2025-11-13checkpath: pass TRUNC to initial opening flags if usedAnna (navi) Figueiredo Gomes
2025-11-13checkpath: unify default mode checkAnna (navi) Figueiredo Gomes
2025-11-13checkpath: formatting: check conditions in-placeAnna (navi) Figueiredo Gomes
2025-11-13checkpath: remove unnecessary memsetAnna (navi) Figueiredo Gomes
2025-11-13checkpath: unify umask call when creating $pathAnna (navi) Figueiredo Gomes
2025-11-13checkpath: simplify open flagsAnna (navi) Figueiredo Gomes
O_CLOEXEC and O_NOFOLLOW are posix for a while now, no need to check.
2025-11-13checkpath: use result of basename_c(path) directlyAnna (navi) Figueiredo Gomes
path is not modified in that function, and basename_c already returns a null-terminated string, so there's no need to allocate a copy
2025-11-13checkpath: formatting: unify variable declarationsAnna (navi) Figueiredo Gomes
2025-11-13checkpath: use switch over if-else chainAnna (navi) Figueiredo Gomes
2025-11-13checkpath: use early returnsAnna (navi) Figueiredo Gomes
2025-11-13checkpath: formatting: use single quotes over backtickAnna (navi) Figueiredo Gomes
2025-11-13checkpath: formatting: remove odd line breaksAnna (navi) Figueiredo Gomes
2025-06-16checkpath,shared/misc: remove is_writable helperAnna (navi) Figueiredo Gomes
only one consumer, checkpath, and can easily be done directly with the access syscall
2025-03-22checkpath: remove unneeded _GNU_SOURCE defineNRK
b6fef599b added it along with libgen.h include, presuably to get the glibc specific basename() definition. but even that commit never really used that function and used basename_c() instead. so this was always unnecessary. the libgen.h include was also removed in c80d6bb2.
2023-01-29checkpath: missing includes from IWYUSam James
2023-01-15checkpath: add missing sticky/set*id mode bits to checkMike Frysinger
We incorrectly masked out the upper 3 bits when checking to see if the permissions need updating leading us to run chmod when not needed. Fixes #482.
2023-01-15checkpath: fix initial dirfd openingMike Frysinger
dirfd is uninitialized at this point, and even if it were, it doesn't make sense to use since the path is "/" -- the dirfd is ignored when the path is absolute. Switch to AT_FDCWD to avoid all that.
2022-05-08checkpath: fix memory leakSam James
``` ================================================================= ==22862==ERROR: LeakSanitizer: detected memory leaks Direct leak of 4096 byte(s) in 1 object(s) allocated from: #0 0x7f1fd5b12cb7 in __interceptor_malloc /usr/src/debug/sys-devel/gcc-11.2.1_p20220312/gcc-11-20220312/libsanitizer/asan/asan_malloc_linux.cpp:145 #1 0x55556abecea7 in xmalloc ../src/includes/helpers.h:64 #2 0x55556abecea7 in xasprintf ../src/includes/helpers.h:149 #3 0x55556abeb6fb in do_check ../src/rc/checkpath.c:206 #4 0x55556abeb6fb in main ../src/rc/checkpath.c:443 #5 0x7f1fd58576cf in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 SUMMARY: AddressSanitizer: 4096 byte(s) leaked in 1 allocation(s). ``` Signed-off-by: Sam James <sam@gentoo.org>
2022-05-08checkpath: fix memory leakSam James
``` Direct leak of 4 byte(s) in 1 object(s) allocated from: #0 0x7f49539534a7 in __interceptor_strdup /usr/src/debug/sys-devel/gcc-11.2.1_p20220312/gcc-11-20220312/libsanitizer/asan/asan_interceptors.cpp:454 #1 0x55d76fa66867 in xstrdup ../src/includes/helpers.h:91 #2 0x55d76fa66867 in get_dirfd ../src/rc/checkpath.c:111 #3 0x55d76fa66867 in do_check ../src/rc/checkpath.c:206 #4 0x55d76fa66867 in main ../src/rc/checkpath.c:442 #5 0x7f49536f06cf in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 ``` Signed-off-by: Sam James <sam@gentoo.org>
2022-04-30multiple spelling and typo fixesJosh Soref
This fixes #516.
2022-04-06migrate fully to meson build systemWilliam Hubbs
- drop old build system - move shared include and source files to common directory - drop "rc-" prefix from shared include and source files - move executable-specific code to individual directories under src - adjust top-level .gitignore file for new build system This closes #489.