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.
This commit is contained in:
parent
32715e1144
commit
b778c72f81
@ -89,7 +89,7 @@ static int get_dirfd(char *path, bool symlinks)
|
|||||||
|
|
||||||
if (!path || *path != '/')
|
if (!path || *path != '/')
|
||||||
eerrorx("%s: empty or relative path", applet);
|
eerrorx("%s: empty or relative path", applet);
|
||||||
dirfd = openat(dirfd, "/", O_RDONLY);
|
dirfd = openat(AT_FDCWD, "/", O_RDONLY);
|
||||||
if (dirfd == -1)
|
if (dirfd == -1)
|
||||||
eerrorx("%s: unable to open the root directory: %s",
|
eerrorx("%s: unable to open the root directory: %s",
|
||||||
applet, strerror(errno));
|
applet, strerror(errno));
|
||||||
|
Loading…
Reference in New Issue
Block a user