diff options
Diffstat (limited to 'c_src')
-rw-r--r-- | c_src/cmd_attr.c | 3 | ||||
-rw-r--r-- | c_src/posix_to_bcachefs.c | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/c_src/cmd_attr.c b/c_src/cmd_attr.c index 78df1be8..0fc21824 100644 --- a/c_src/cmd_attr.c +++ b/c_src/cmd_attr.c @@ -48,11 +48,11 @@ static void propagate_recurse(int dirfd) continue; } propagate_recurse(fd); - xclose(fd); } if (errno) die("readdir error: %m"); + closedir(dir); } static void do_setattr(char *path, struct bch_opt_strs opts) @@ -80,7 +80,6 @@ static void do_setattr(char *path, struct bch_opt_strs opts) die("error opening %s: %m", path); propagate_recurse(dirfd); - xclose(dirfd); } static void setattr_usage(void) diff --git a/c_src/posix_to_bcachefs.c b/c_src/posix_to_bcachefs.c index 4ff776f3..880ef531 100644 --- a/c_src/posix_to_bcachefs.c +++ b/c_src/posix_to_bcachefs.c @@ -387,7 +387,6 @@ static void copy_dir(struct copy_fs_state *s, case DT_DIR: fd = xopen(d->d_name, O_RDONLY|O_NOATIME); copy_dir(s, c, &inode, fd, child_path, reserve_start); - xclose(fd); break; case DT_REG: inode.bi_size = stat.st_size; @@ -420,6 +419,7 @@ next: } darray_exit(&dirents); + closedir(dir); } static void reserve_old_fs_space(struct bch_fs *c, @@ -473,7 +473,7 @@ void copy_fs(struct bch_fs *c, int src_fd, const char *src_path, copy_xattrs(c, &root_inode, "."); /* now, copy: */ - copy_dir(s, c, &root_inode, src_fd, src_path, reserve_start); + copy_dir(s, c, &root_inode, dup(src_fd), src_path, reserve_start); if (s->type == BCH_MIGRATE_migrate) reserve_old_fs_space(c, &root_inode, &s->extents, reserve_start); |