From b778c72f81b8c23676b367807e2baa18bfef0747 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 15 Jan 2023 15:17:18 -0500 Subject: 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. --- src/checkpath/checkpath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)); -- cgit v1.2.3