aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorÉrico Nogueira Rolim <[email protected]>2020-12-10 02:24:59 -0300
committerGitHub <[email protected]>2020-12-09 21:24:59 -0800
commit957f9681eb7ce5562f4912e97fc64aeceb23bd7f (patch)
treed6a0b53fa356e3f9dcbf535479d95069e163b64b
parent1e4667af320df1a99cb3995d18054fb207dd5d02 (diff)
mount_zfs: print strerror instead of errno for error reporting
Tracking down an error message with the errno value can be difficult, using strerror makes the error message clearer. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Érico Rolim <[email protected]> Closes #11303
-rw-r--r--cmd/mount_zfs/mount_zfs.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/cmd/mount_zfs/mount_zfs.c b/cmd/mount_zfs/mount_zfs.c
index 0e7810703..ca39d2284 100644
--- a/cmd/mount_zfs/mount_zfs.c
+++ b/cmd/mount_zfs/mount_zfs.c
@@ -110,8 +110,8 @@ mtab_update(char *dataset, char *mntpoint, char *type, char *mntopts)
if (!fp) {
(void) fprintf(stderr, gettext(
"filesystem '%s' was mounted, but /etc/mtab "
- "could not be opened due to error %d\n"),
- dataset, errno);
+ "could not be opened due to error: %s\n"),
+ dataset, strerror(errno));
return (MOUNT_FILEIO);
}
@@ -119,8 +119,8 @@ mtab_update(char *dataset, char *mntpoint, char *type, char *mntopts)
if (error) {
(void) fprintf(stderr, gettext(
"filesystem '%s' was mounted, but /etc/mtab "
- "could not be updated due to error %d\n"),
- dataset, errno);
+ "could not be updated due to error: %s\n"),
+ dataset, strerror(errno));
return (MOUNT_FILEIO);
}
@@ -200,8 +200,8 @@ main(int argc, char **argv)
/* canonicalize the mount point */
if (realpath(argv[1], mntpoint) == NULL) {
(void) fprintf(stderr, gettext("filesystem '%s' cannot be "
- "mounted at '%s' due to canonicalization error %d.\n"),
- dataset, argv[1], errno);
+ "mounted at '%s' due to canonicalization error: %s\n"),
+ dataset, argv[1], strerror(errno));
return (MOUNT_SYSERR);
}