All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nilfs2-utils: change the error message of nilfs-tune properly
@ 2010-09-12 14:10 Jiro SEKIBA
       [not found] ` <8762ybkq7j.wl%jir-27yqGEOhnJbQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Jiro SEKIBA @ 2010-09-12 14:10 UTC (permalink / raw)
  To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Ryusuke Konishi, Ryusuke Konishi

hi, 

This patch modifies the error message of nilfs-tune when user doesn't have
a permission to access the device to show the cause of error clearly.

Signed-off-by: Jiro SEKIBA <jir-hfpbi5WX9J54Eiagz67IpQ@public.gmane.org>
---
 sbin/nilfs-tune/nilfs-tune.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/sbin/nilfs-tune/nilfs-tune.c b/sbin/nilfs-tune/nilfs-tune.c
index 18513f2..f6cdd36 100644
--- a/sbin/nilfs-tune/nilfs-tune.c
+++ b/sbin/nilfs-tune/nilfs-tune.c
@@ -394,10 +394,12 @@ int modify_nilfs(char *device, struct nilfs_tune_options *opts)
 	struct nilfs_super_block *sbp;
 	__u64 features;
 
+	errno = 0;
 	devfd = open(device, opts->flags);
 
 	if (devfd == -1) {
-		fprintf(stderr, "%s: cannot open NILFS\n", device);
+		fprintf(stderr, "%s: cannot open device %s\n",
+			strerror(errno), device);
 		ret = EXIT_FAILURE;
 		goto out;
 	}
-- 
1.7.0.4

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] nilfs2-utils: change the error message of nilfs-tune properly
       [not found] ` <8762ybkq7j.wl%jir-27yqGEOhnJbQT0dZR+AlfA@public.gmane.org>
@ 2010-09-12 14:51   ` Ryusuke Konishi
  0 siblings, 0 replies; 2+ messages in thread
From: Ryusuke Konishi @ 2010-09-12 14:51 UTC (permalink / raw)
  To: jir-hfpbi5WX9J54Eiagz67IpQ
  Cc: linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg

Hi,
On Sun, 12 Sep 2010 23:10:24 +0900, Jiro SEKIBA wrote:
> hi, 
> 
> This patch modifies the error message of nilfs-tune when user doesn't have
> a permission to access the device to show the cause of error clearly.
> 
> Signed-off-by: Jiro SEKIBA <jir-hfpbi5WX9J54Eiagz67IpQ@public.gmane.org>
> ---
>  sbin/nilfs-tune/nilfs-tune.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/sbin/nilfs-tune/nilfs-tune.c b/sbin/nilfs-tune/nilfs-tune.c
> index 18513f2..f6cdd36 100644
> --- a/sbin/nilfs-tune/nilfs-tune.c
> +++ b/sbin/nilfs-tune/nilfs-tune.c
> @@ -394,10 +394,12 @@ int modify_nilfs(char *device, struct nilfs_tune_options *opts)
>  	struct nilfs_super_block *sbp;
>  	__u64 features;
>  
> +	errno = 0;
>  	devfd = open(device, opts->flags);
>  
>  	if (devfd == -1) {
> -		fprintf(stderr, "%s: cannot open NILFS\n", device);
> +		fprintf(stderr, "%s: cannot open device %s\n",
> +			strerror(errno), device);

How about putting the error string behind the primary message?

		fprintf(stderr, "cannot open device %s: %s\n", device,
			strerror(errno));

Thanks,
Ryusuke Konishi

>  		ret = EXIT_FAILURE;
>  		goto out;
>  	}
> -- 
> 1.7.0.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-12 14:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-12 14:10 [PATCH] nilfs2-utils: change the error message of nilfs-tune properly Jiro SEKIBA
     [not found] ` <8762ybkq7j.wl%jir-27yqGEOhnJbQT0dZR+AlfA@public.gmane.org>
2010-09-12 14:51   ` Ryusuke Konishi

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.