Fix fdwalk
It turns out you can't readdir from an O_PATH file-descriptor, so fdwalk didn't work. Spotted the BADFD in a strace. Closes: #60 Approved by: cgwalters
This commit is contained in:

committed by
Colin Walters (automation)

parent
bf6e3564a3
commit
b9c39e5beb
2
utils.c
2
utils.c
@@ -262,7 +262,7 @@ fdwalk (int proc_fd, int (*cb)(void *data, int fd), void *data)
|
||||
int res = 0;
|
||||
DIR *d;
|
||||
|
||||
dfd = openat (proc_fd, "self/fd", O_DIRECTORY | O_PATH);
|
||||
dfd = openat (proc_fd, "self/fd", O_DIRECTORY | O_RDONLY | O_NONBLOCK | O_CLOEXEC | O_NOCTTY);
|
||||
if (dfd == -1)
|
||||
return res;
|
||||
|
||||
|
Reference in New Issue
Block a user