Print human readable error message for ENOENT
authorRichard Yao <ryao@cs.stonybrook.edu>
Tue, 3 Apr 2012 00:44:42 +0000 (20:44 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 3 Apr 2012 17:24:34 +0000 (10:24 -0700)
A cryptic error code is printed when mounting a legacy dataset to a
non-existent mountpoint. This patch changes this behavior to print
"mount point '%s' does not exist", which is similar to the error
message printed when mounting procfs.

The single quotes were added to be consistent with the existing EBUSY
error message, which is the only difference between this error message
and the one that is printed when the same condition occurs when mounting
procfs.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #633

cmd/mount_zfs/mount_zfs.c

index 6a2e9ff..1a8c98c 100644 (file)
@@ -480,6 +480,10 @@ main(int argc, char **argv)
                    mntflags, mntopts);
                if (error) {
                        switch (errno) {
+                       case ENOENT:
+                               (void) fprintf(stderr, gettext("mount point "
+                                   "'%s' does not exist\n"), mntpoint);
+                               return (MOUNT_SYSERR);
                        case EBUSY:
                                (void) fprintf(stderr, gettext("filesystem "
                                    "'%s' is already mounted\n"), dataset);