[PATCH] Improve error handling in filesystem df

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The return values of ioctl weren't being printed to stderr on failure,
causing the command to silently fail, resulting in a very confused
user.

Signed-off-by: Ben Gamari <bgamari.foss@xxxxxxxxx>
---
 btrfs_cmds.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/btrfs_cmds.c b/btrfs_cmds.c
index 8031c58..45da2bd 100644
--- a/btrfs_cmds.c
+++ b/btrfs_cmds.c
@@ -857,6 +857,7 @@ int do_df_filesystem(int nargs, char **argv)
 
 	ret = ioctl(fd, BTRFS_IOC_SPACE_INFO, sargs);
 	if (ret) {
+		fprintf(stderr, "ERROR: can't query '%s' for free space (%s)\n", path, strerror(-ret));
 		free(sargs);
 		return ret;
 	}
@@ -875,6 +876,7 @@ int do_df_filesystem(int nargs, char **argv)
 
 	ret = ioctl(fd, BTRFS_IOC_SPACE_INFO, sargs);
 	if (ret) {
+		fprintf(stderr, "ERROR: can't query '%s' for free space (%s)\n", path, strerror(-ret));
 		free(sargs);
 		return ret;
 	}
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux