Improve error handling in the btrfs command
authorGoffredo Baroncelli <kreijack@libero.it>
Mon, 20 Dec 2010 20:06:19 +0000 (20:06 +0000)
committerChris Mason <chris.mason@oracle.com>
Tue, 25 Oct 2011 13:18:31 +0000 (09:18 -0400)
commit17cf679fb3622a9e3452777d07fcf3a346266ff1
tree50b0745e40f8102f1e6e3b26eec3c5a865d3d42d
parent0646719841433c015d849c197cd13be6f2cb31a3
Improve error handling in the btrfs command

Hi Chris,

below is enclosed a trivial patch, which has the aim to improve the error
reporting of the "btrfs" command.

You can pull from

http://cassiopea.homelinux.net/git/btrfs-progs-unstable.git

branch

strerror

I changed every printf("some-error") to something like:

e = errno;
fprintf(stderr, "ERROR: .... - %s", strerror(e));

so:

1) all the error are reported to standard error
2) At the end of the message is printed the error as returned by the system.

The change is quite simple, I replaced every printf("some-error") to the line
above. I don't touched anything other.
I also integrated a missing "printf" on the basis of the Ben patch.

This patch leads the btrfs command to be more "user friendly" :-)

Regards
G.Baroncelli

 btrfs-list.c |   40 ++++++++++++++++++++++--------
 btrfs_cmds.c |   77 ++++++++++++++++++++++++++++++++++++++++-----------------
 utils.c      |    6 ++++
 3 files changed, 89 insertions(+), 34 deletions(-)

Signed-off-by: Chris Mason <chris.mason@oracle.com>
btrfs-list.c
btrfs_cmds.c
utils.c