btrfs-progs: fix error checking in load_device_info
authorDavid Sterba <dsterba@suse.com>
Fri, 2 Oct 2015 15:44:21 +0000 (17:44 +0200)
committerDavid Sterba <dsterba@suse.com>
Fri, 2 Oct 2015 15:56:43 +0000 (17:56 +0200)
commit49ac9aa1e8185f84c00e9ae1ce12b290c2df2830
treecf23fa4346699458454177c3218268d284765697
parent1491d246c427f4fe13521b13fab64c91459ffd9e
btrfs-progs: fix error checking in load_device_info

load_device_info queries the FS_INFO ioctl and this may fail with EPERM
on older kernels. The check did not verify the ioctl return value and
incorrectly returned EPERM if it was previously stored in errno.

This fixes 'btrfs fi usage' that will print the overall summary for all
users (provided that the FS_INFO ioctl is already unprivileged).

Signed-off-by: David Sterba <dsterba@suse.com>
cmds-fi-usage.c