Skip to contentSkip to conversation

nilfs2-utils: change the error message of nilfs-tune properly

PATCH Superseded Jiro SEKIBA 2 participants 2 messages Sep 12, 2010 1 message not in the archive NILFS2 filesystem

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nilfs2-utils: change the error message of nilfs-tune properly

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.

---
 sbin/nilfs-tune/nilfs-tune.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
sbin/nilfs-tune/nilfs-tune.c +3 -1
index 18513f2..f6cdd36 100644
@@ -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;
 	}
Signature · 6 lines
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 8762ybkq7j.wl%[email protected]

#2 lore raw

Hi,

Quoted 15 lines · Jiro SEKIBA

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.

---
 sbin/nilfs-tune/nilfs-tune.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
sbin/nilfs-tune/nilfs-tune.c +0 -0
index 18513f2..f6cdd36 100644

sbin/nilfs-tune/nilfs-tune.c int modify_nilfs(char *device, struct nilfs_tune_options *opts) · line 402

Quoted 10 lines
sbin/nilfs-tune/nilfs-tune.c +3 -1
@@ -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

Quoted 6 lines
sbin/nilfs-tune/nilfs-tune.c +0 -0
 		ret = EXIT_FAILURE;
 		goto out;
 	}
Signature · 1 line
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html