commit e76f2c74b8a27db8a3d05aee6293b94ecc8452ce from: Omar Polo date: Sun Apr 25 12:19:06 2021 UTC don't save the directory fd in c->pfd scandir_fd already calls closedir, which in turns closes the fd commit - 11c986679a15e976e5fdde5e439a18be4acac0de commit + e76f2c74b8a27db8a3d05aee6293b94ecc8452ce blob - 86d007a0bd5418a473a1444d43663fd443306922 blob + 5812c664765b7d7901c186f84883de6a2f97539e --- server.c +++ server.c @@ -778,10 +778,9 @@ open_dir(struct client *c) break; } - c->pfd = dirfd; c->next = enter_handle_dirlist; - c->dirlen = scandir_fd(c->pfd, &c->dir, + c->dirlen = scandir_fd(dirfd, &c->dir, root ? select_non_dotdot : select_non_dot, alphasort); if (c->dirlen == -1) {