Include <locale.h> to avoid error: 'LC_ALL' undeclared.
[zfs.git] / cmd / mount_zfs / mount_zfs.c
index e97b2b8..45c291e 100644 (file)
@@ -30,6 +30,7 @@
 #include <sys/mount.h>
 #include <sys/stat.h>
 #include <libzfs.h>
+#include <locale.h>
 #ifdef HAVE_LIBSELINUX
 #include <selinux/selinux.h>
 #endif /* HAVE_LIBSELINUX */
@@ -96,6 +97,7 @@ static const option_map_t option_map[] = {
        { MNTOPT_QUIET,         MS_SILENT,      ZS_COMMENT      },
 #endif
        /* Custom zfs options */
+       { MNTOPT_XATTR,         MS_COMMENT,     ZS_COMMENT      },
        { MNTOPT_NOXATTR,       MS_COMMENT,     ZS_COMMENT      },
        { MNTOPT_ZFSUTIL,       MS_COMMENT,     ZS_ZFSUTIL      },
        { NULL,                 0,              0               } };
@@ -252,7 +254,7 @@ mtab_is_writeable(void)
        struct stat st;
        int error, fd;
 
-       error = stat(MNTTAB, &st);
+       error = lstat(MNTTAB, &st);
        if (error || S_ISLNK(st.st_mode))
                return (0);
 
@@ -479,6 +481,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);