* [PATCH] Improve error handling in filesystem df
@ 2010-12-19 22:29 Ben Gamari
2010-12-20 20:16 ` Goffredo Baroncelli
0 siblings, 1 reply; 2+ messages in thread
From: Ben Gamari @ 2010-12-19 22:29 UTC (permalink / raw
To: linux-btrfs; +Cc: Ben Gamari
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@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Improve error handling in filesystem df
2010-12-19 22:29 [PATCH] Improve error handling in filesystem df Ben Gamari
@ 2010-12-20 20:16 ` Goffredo Baroncelli
0 siblings, 0 replies; 2+ messages in thread
From: Goffredo Baroncelli @ 2010-12-20 20:16 UTC (permalink / raw
To: linux-btrfs; +Cc: Ben Gamari
Hi Ben,
I integrated your patch on the my one (see my next email). However I changed
the argument of the strerror function from the ioctl return code to
the errno variable.
Regards
G.Baroncelli
On Sunday, 19 December, 2010, Ben Gamari wrote:
> 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@gmail.com>
> ---
> 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@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijack@inwind.it>
Key fingerprint = 4769 7E51 5293 D36C 814E C054 BF04 F161 3DC5 0512
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-12-20 20:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-19 22:29 [PATCH] Improve error handling in filesystem df Ben Gamari
2010-12-20 20:16 ` Goffredo Baroncelli
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.