btrfs-progs: pass positive errno to strerror in cmd_df()
authorEric Sandeen <sandeen@redhat.com>
Wed, 6 Nov 2013 23:15:50 +0000 (17:15 -0600)
committerChris Mason <chris.mason@fusionio.com>
Thu, 7 Nov 2013 21:10:41 +0000 (16:10 -0500)
get_df returns a negative error number, but then
we pass it to strerror, which wants a positive value...

Resolves-Coverity-CID: 1125929
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
cmds-filesystem.c

index 376037b..b4727c2 100644 (file)
@@ -173,7 +173,7 @@ static int cmd_df(int argc, char **argv)
                print_df(sargs);
                free(sargs);
        } else {
-               fprintf(stderr, "ERROR: get_df failed %s\n", strerror(ret));
+               fprintf(stderr, "ERROR: get_df failed %s\n", strerror(-ret));
        }
 
        close_file_or_dir(fd, dirstream);