do not trim leading pathname from special device name
[unix-history] / usr / src / sbin / mount / mount.c
index 9772263..262e57b 100644 (file)
@@ -22,7 +22,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)mount.c    5.23 (Berkeley) %G%";
+static char sccsid[] = "@(#)mount.c    5.27 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "pathnames.h"
 #endif /* not lint */
 
 #include "pathnames.h"
@@ -160,7 +160,7 @@ main(argc, argv, arge)
        if (argc == 0) {
                if (verbose || fake || type)
                        usage();
        if (argc == 0) {
                if (verbose || fake || type)
                        usage();
-               if ((mntsize = getmntinfo(&mntbuf)) == 0) {
+               if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0) {
                        fprintf(stderr,
                                "mount: cannot get mount information\n");
                        exit(1);
                        fprintf(stderr,
                                "mount: cannot get mount information\n");
                        exit(1);
@@ -179,6 +179,10 @@ main(argc, argv, arge)
                        exit(1);
                }
                mnttype = mntbuf->f_type;
                        exit(1);
                }
                mnttype = mntbuf->f_type;
+               if (!strcmp(mntbuf->f_mntfromname, "root_device")) {
+                       fs = getfsfile("/");
+                       strcpy(mntbuf->f_mntfromname, fs->fs_spec);
+               }
                exit(mountfs(mntbuf->f_mntfromname, mntbuf->f_mntonname,
                    updateflg, type, options, NULL));
        }
                exit(mountfs(mntbuf->f_mntfromname, mntbuf->f_mntonname,
                    updateflg, type, options, NULL));
        }
@@ -330,18 +334,9 @@ prmount(spec, name, flags)
        char *spec, *name;
        long flags;
 {
        char *spec, *name;
        long flags;
 {
-       register char *root;
 
        if (opflags & ISBGRND)
                return;
 
        if (opflags & ISBGRND)
                return;
-       /*
-        * trim trailing /'s and find last component of name
-        */
-       for (root = index(spec, '\0'); *--root == '/';)
-               /* void */;
-       *++root = '\0';
-       if (root = rindex(spec, '/'))
-               spec = root + 1;
        printf("%s on %s", spec, name);
        if (flags & M_RDONLY)
                printf(" (read-only)");
        printf("%s on %s", spec, name);
        if (flags & M_RDONLY)
                printf(" (read-only)");
@@ -469,7 +464,7 @@ getmntpt(name)
        register long i;
        struct statfs *mntbuf;
 
        register long i;
        struct statfs *mntbuf;
 
-       mntsize = getmntinfo(&mntbuf);
+       mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
        for (i = 0; i < mntsize; i++) {
                if (!strcmp(mntbuf[i].f_mntfromname, name) ||
                    !strcmp(mntbuf[i].f_mntonname, name))
        for (i = 0; i < mntsize; i++) {
                if (!strcmp(mntbuf[i].f_mntfromname, name) ||
                    !strcmp(mntbuf[i].f_mntonname, name))
@@ -582,6 +577,7 @@ char *
 getnfsargs(spec)
        char *spec;
 {
 getnfsargs(spec)
        char *spec;
 {
+       extern int errno;
        register CLIENT *clp;
        struct hostent *hp;
        static struct sockaddr_in saddr;
        register CLIENT *clp;
        struct hostent *hp;
        static struct sockaddr_in saddr;