aboutsummaryrefslogtreecommitdiffstats
path: root/cmds-filesystem.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-01-12 11:20:18 +0100
committerDavid Sterba <dsterba@suse.com>2016-01-12 15:02:55 +0100
commit633dc6f80f201afdf5b8524ae377187d58f0ef3b (patch)
treeca5b6375fb6910ac51eea8b89173c45390ce0355 /cmds-filesystem.c
parent374d67fdef869d2e2dfb9907d21c85ee6c19e1d7 (diff)
downloadbtrfs-progs-633dc6f80f201afdf5b8524ae377187d58f0ef3b.tar.gz
btrfs-progs-633dc6f80f201afdf5b8524ae377187d58f0ef3b.tar.xz
btrfs-progs-633dc6f80f201afdf5b8524ae377187d58f0ef3b.zip
btrfs-progs: remove unnecessary errno temp variables
We can read errno directly if it's not clobbered by any intermediate calls. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-filesystem.c')
-rw-r--r--cmds-filesystem.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index b6cb0bc..29ed7cb 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -130,7 +130,7 @@ static const char * const cmd_filesystem_df_usage[] = {
static int get_df(int fd, struct btrfs_ioctl_space_args **sargs_ret)
{
u64 count = 0;
- int ret, e;
+ int ret;
struct btrfs_ioctl_space_args *sargs;
sargs = malloc(sizeof(struct btrfs_ioctl_space_args));
@@ -141,11 +141,10 @@ static int get_df(int fd, struct btrfs_ioctl_space_args **sargs_ret)
sargs->total_spaces = 0;
ret = ioctl(fd, BTRFS_IOC_SPACE_INFO, sargs);
- e = errno;
if (ret) {
- error("cannot get space info: %s\n", strerror(e));
+ error("cannot get space info: %s\n", strerror(errno));
free(sargs);
- return -e;
+ return -errno;
}
/* This really should never happen */
if (!sargs->total_spaces) {
@@ -163,12 +162,11 @@ static int get_df(int fd, struct btrfs_ioctl_space_args **sargs_ret)
sargs->space_slots = count;
sargs->total_spaces = 0;
ret = ioctl(fd, BTRFS_IOC_SPACE_INFO, sargs);
- e = errno;
if (ret) {
error("cannot get space info with %llu slots: %s",
- count, strerror(e));
+ count, strerror(errno));
free(sargs);
- return -e;
+ return -errno;
}
*sargs_ret = sargs;
return 0;
@@ -995,7 +993,6 @@ static int defrag_callback(const char *fpath, const struct stat *sb,
if (defrag_global_verbose)
printf("%s\n", fpath);
fd = open(fpath, O_RDWR);
- e = errno;
if (fd < 0)
goto error;
ret = do_defrag(fd, defrag_global_fancy_ioctl, &defrag_global_range);