Print this page
OS-5509 /native/usr/bin/mount does not work in LX
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>

@@ -19,10 +19,11 @@
  * CDDL HEADER END
  */
 
 /*
  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright 2016 Joyent, Inc.
  */
 
 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
 /*        All Rights Reserved   */
 

@@ -53,10 +54,11 @@
 #include        <sys/signal.h>
 #include        <sys/resource.h>
 #include        <stropts.h>
 #include        <sys/conf.h>
 #include        <locale.h>
+#include        <zone.h>
 #include        "fslib.h"
 
 #define VFS_PATH        "/usr/lib/fs"
 #define ALT_PATH        "/etc/fs"
 #define REMOTE          "/etc/dfs/fstypes"

@@ -799,18 +801,20 @@
 }
 
 void
 doexec(char *fstype, char *newargv[])
 {
+        const char *zroot = zone_get_nroot();
         char    full_path[PATH_MAX];
         char    alter_path[PATH_MAX];
         char    *vfs_path = VFS_PATH;
         char    *alt_path = ALT_PATH;
         int     i;
 
         /* build the full pathname of the fstype dependent command. */
-        sprintf(full_path, "%s/%s/%s", vfs_path, fstype, myname);
+        (void) snprintf(full_path, sizeof (full_path), "%s/%s/%s/%s",
+            (zroot != NULL ? zroot : ""), vfs_path, fstype, myname);
         sprintf(alter_path, "%s/%s/%s", alt_path, fstype, myname);
         newargv[1] = myname;
 
         if (Vflg) {
                 printf("%s -F %s", newargv[1], fstype);