recurse_fd() consumes each directory fd passed to it, but it has no
cleanup set up until after take_fdopendir() succeeds.
Errors and skipped procfs, sysfs, or read-only subtrees therefore leak the
incoming fd.
Follow-up for
b1fb2d971c810e0bdf9ff0ae567a1c6c230e4e5d
F_TYPE_EQUAL(sfs->f_type, SYSFS_MAGIC);
}
-static int recurse_fd(int fd, const struct stat *st, uid_t shift, bool is_toplevel) {
+static int recurse_fd(int input_fd, const struct stat *st, uid_t shift, bool is_toplevel) {
_cleanup_closedir_ DIR *d = NULL;
+ _cleanup_close_ int fd = input_fd;
bool changed = false;
struct statfs sfs;
int r;