mirror of
https://github.com/kdave/btrfs-progs
synced 2025-04-07 09:41:29 +00:00
btrfs-progs: use on-stack buffer in __ino_to_path_fd
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
5c132351e4
commit
d7492ec59e
@ -42,15 +42,11 @@ static int __ino_to_path_fd(u64 inum, int fd, int verbose, const char *prepend)
|
|||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
struct btrfs_ioctl_ino_path_args ipa;
|
struct btrfs_ioctl_ino_path_args ipa;
|
||||||
struct btrfs_data_container *fspath;
|
struct btrfs_data_container fspath[PATH_MAX];
|
||||||
|
|
||||||
fspath = malloc(4096);
|
|
||||||
if (!fspath)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
memset(fspath, 0, sizeof(*fspath));
|
memset(fspath, 0, sizeof(*fspath));
|
||||||
ipa.inum = inum;
|
ipa.inum = inum;
|
||||||
ipa.size = 4096;
|
ipa.size = PATH_MAX;
|
||||||
ipa.fspath = ptr_to_u64(fspath);
|
ipa.fspath = ptr_to_u64(fspath);
|
||||||
|
|
||||||
ret = ioctl(fd, BTRFS_IOC_INO_PATHS, &ipa);
|
ret = ioctl(fd, BTRFS_IOC_INO_PATHS, &ipa);
|
||||||
@ -79,7 +75,6 @@ static int __ino_to_path_fd(u64 inum, int fd, int verbose, const char *prepend)
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(fspath);
|
|
||||||
return !!ret;
|
return !!ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user