aboutsummaryrefslogtreecommitdiff
path: root/src/checkpath
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2023-01-15 15:17:18 -0500
committerMike Frysinger <vapier@gentoo.org>2023-01-15 15:17:18 -0500
commitb778c72f81b8c23676b367807e2baa18bfef0747 (patch)
tree6c80a67e91f747cb33ef90395038437eee761593 /src/checkpath
parent32715e11441d01ff106dae8ac90a78fabc8e4e63 (diff)
checkpath: fix initial dirfd opening
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.
Diffstat (limited to 'src/checkpath')
-rw-r--r--src/checkpath/checkpath.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/checkpath/checkpath.c b/src/checkpath/checkpath.c
index a98703a9..1ced7168 100644
--- a/src/checkpath/checkpath.c
+++ b/src/checkpath/checkpath.c
@@ -89,7 +89,7 @@ static int get_dirfd(char *path, bool symlinks)
if (!path || *path != '/')
eerrorx("%s: empty or relative path", applet);
- dirfd = openat(dirfd, "/", O_RDONLY);
+ dirfd = openat(AT_FDCWD, "/", O_RDONLY);
if (dirfd == -1)
eerrorx("%s: unable to open the root directory: %s",
applet, strerror(errno));