diff options
author | David Sterba <dsterba@suse.com> | 2016-01-12 13:35:50 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-01-12 15:02:55 +0100 |
commit | ac4ec4d4f44e67fc3d1fd806cf7acbe2485cedee (patch) | |
tree | 434f39155069a914bc76d3e9fdca87a331012b7a /cmds-device.c | |
parent | 633dc6f80f201afdf5b8524ae377187d58f0ef3b (diff) |
btrfs-progs: check for negative return value from ioctl
Handle only negative values returned by ioctl syscalls, with exception
of the device remove. It returns positive values that are handled later.
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-device.c')
-rw-r--r-- | cmds-device.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cmds-device.c b/cmds-device.c index f69d0248..50c1c5df 100644 --- a/cmds-device.c +++ b/cmds-device.c @@ -166,6 +166,10 @@ static int _cmd_device_remove(int argc, char **argv, } memset(&arg, 0, sizeof(arg)); strncpy_null(arg.name, argv[i]); + /* + * Positive values are from BTRFS_ERROR_DEV_*, + * otherwise it's a generic error, one of errnos + */ res = ioctl(fdmnt, BTRFS_IOC_RM_DEV, &arg); if (res) { const char *msg; |