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

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/fs.d/mount.c
          +++ new/usr/src/cmd/fs.d/mount.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
       24 + * Copyright 2016 Joyent, Inc.
  24   25   */
  25   26  
  26   27  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  27   28  /*        All Rights Reserved   */
  28   29  
  29   30  
  30   31  /*
  31   32   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  32   33   * Use is subject to license terms.
  33   34   */
↓ open down ↓ 14 lines elided ↑ open up ↑
  48   49  #include        <sys/mntent.h>
  49   50  #include        <sys/mount.h>
  50   51  #include        <sys/vfstab.h>
  51   52  #include        <sys/param.h>
  52   53  #include        <sys/wait.h>
  53   54  #include        <sys/signal.h>
  54   55  #include        <sys/resource.h>
  55   56  #include        <stropts.h>
  56   57  #include        <sys/conf.h>
  57   58  #include        <locale.h>
       59 +#include        <zone.h>
  58   60  #include        "fslib.h"
  59   61  
  60   62  #define VFS_PATH        "/usr/lib/fs"
  61   63  #define ALT_PATH        "/etc/fs"
  62   64  #define REMOTE          "/etc/dfs/fstypes"
  63   65  
  64   66  #define ARGV_MAX        16
  65   67  #define TIME_MAX        50
  66   68  #define FSTYPE_MAX      8
  67   69  #define REMOTE_MAX      64
↓ open down ↓ 726 lines elided ↑ open up ↑
 794  796                      gettext("%s: Line in mnttab has too many entries\n"),
 795  797                      myname);
 796  798                  break;
 797  799          }
 798  800          exit(1);
 799  801  }
 800  802  
 801  803  void
 802  804  doexec(char *fstype, char *newargv[])
 803  805  {
      806 +        const char *zroot = zone_get_nroot();
 804  807          char    full_path[PATH_MAX];
 805  808          char    alter_path[PATH_MAX];
 806  809          char    *vfs_path = VFS_PATH;
 807  810          char    *alt_path = ALT_PATH;
 808  811          int     i;
 809  812  
 810  813          /* build the full pathname of the fstype dependent command. */
 811      -        sprintf(full_path, "%s/%s/%s", vfs_path, fstype, myname);
      814 +        (void) snprintf(full_path, sizeof (full_path), "%s/%s/%s/%s",
      815 +            (zroot != NULL ? zroot : ""), vfs_path, fstype, myname);
 812  816          sprintf(alter_path, "%s/%s/%s", alt_path, fstype, myname);
 813  817          newargv[1] = myname;
 814  818  
 815  819          if (Vflg) {
 816  820                  printf("%s -F %s", newargv[1], fstype);
 817  821                  for (i = 2; newargv[i]; i++)
 818  822                          printf(" %s", newargv[i]);
 819  823                  printf("\n");
 820  824                  fflush(stdout);
 821  825                  exit(0);
↓ open down ↓ 809 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX