SCCS-vsn: sbin/mount/mount.c 5.29
SCCS-vsn: sbin/mount/pathnames.h 6.3
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)mount.c 5.28 (Berkeley) %G%";
+static char sccsid[] = "@(#)mount.c 5.29 (Berkeley) %G%";
#endif /* not lint */
#include "pathnames.h"
#endif /* not lint */
#include "pathnames.h"
#include <fstab.h>
#include <errno.h>
#include <stdio.h>
#include <fstab.h>
#include <errno.h>
#include <stdio.h>
#include <strings.h>
#include <sys/mount.h>
#ifdef NFS
#include <strings.h>
#include <sys/mount.h>
#ifdef NFS
extern int optind;
register struct fstab *fs;
register int cnt;
extern int optind;
register struct fstab *fs;
register int cnt;
- int all, ch, rval, flags, i;
+ int all, ch, rval, flags, ret, pid, i;
long mntsize;
struct statfs *mntbuf, *getmntpt();
char *type, *options = NULL;
long mntsize;
struct statfs *mntbuf, *getmntpt();
char *type, *options = NULL;
fs = getfsfile("/");
strcpy(mntbuf->f_mntfromname, fs->fs_spec);
}
fs = getfsfile("/");
strcpy(mntbuf->f_mntfromname, fs->fs_spec);
}
- exit(mountfs(mntbuf->f_mntfromname, mntbuf->f_mntonname,
- updateflg, type, options, NULL));
- }
-
- if (argc == 1) {
+ ret = mountfs(mntbuf->f_mntfromname, mntbuf->f_mntonname,
+ updateflg, type, options, NULL);
+ } else if (argc == 1) {
if (!(fs = getfsfile(*argv)) && !(fs = getfsspec(*argv))) {
fprintf(stderr,
"mount: unknown special file or file system %s.\n",
if (!(fs = getfsfile(*argv)) && !(fs = getfsspec(*argv))) {
fprintf(stderr,
"mount: unknown special file or file system %s.\n",
exit(1);
}
mnttype = getmnttype(fs->fs_vfstype);
exit(1);
}
mnttype = getmnttype(fs->fs_vfstype);
- exit(mountfs(fs->fs_spec, fs->fs_file, updateflg,
- type, options, fs->fs_mntops));
- }
-
- if (argc != 2)
+ ret = mountfs(fs->fs_spec, fs->fs_file, updateflg,
+ type, options, fs->fs_mntops);
+ } else if (argc != 2) {
-
- exit(mountfs(argv[0], argv[1], updateflg, type, options, NULL));
+ ret = 1;
+ } else {
+ ret = mountfs(argv[0], argv[1], updateflg, type, options, NULL);
+ }
+ if ((pidfile = fopen(_PATH_MOUNTDPID, "r")) != NULL) {
+ pid = 0;
+ fscanf(pidfile, "%d", &pid);
+ fclose(pidfile);
+ if (pid > 0)
+ kill(pid, SIGHUP);
+ }
+ exit (ret);
}
mountfs(spec, name, flags, type, options, mntopts)
}
mountfs(spec, name, flags, type, options, mntopts)
getufsopts(options, &flags);
args.fspec = spec;
args.exroot = DEFAULT_ROOTUID;
getufsopts(options, &flags);
args.fspec = spec;
args.exroot = DEFAULT_ROOTUID;
- args.exflags = getexportflags(name, flags);
+ if (flags & M_RDONLY)
+ args.exflags = M_EXRDONLY;
+ else
+ args.exflags = 0;
argp = (caddr_t)&args;
break;
argp = (caddr_t)&args;
break;
-/*
- * Check to see if a UFS filesystem is being exported.
- */
-getexportflags(name, mntflags)
- char *name;
- int mntflags;
-{
- FILE *fd;
- int flags = 0;
- char *cp, line[BUFSIZ];
-
- if (mntflags & M_RDONLY)
- flags |= M_EXRDONLY;
- if ((fd = fopen(_PATH_EXPORTS, "r")) == NULL)
- return (flags);
- while (fgets(line, BUFSIZ, fd)) {
- cp = strtok(line, " \t\n");
- if (strcmp(cp, name))
- continue;
- flags |= M_EXPORTED;
- break;
- }
- fclose(fd);
- return (flags);
-}
-
#ifdef NFS
/*
* Handle the getoption arg.
#ifdef NFS
/*
* Handle the getoption arg.
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#)pathnames.h 6.2 (Berkeley) %G%
+ * @(#)pathnames.h 6.3 (Berkeley) %G%
*/
#define _PATH_EXECDIR "/sbin"
#define _PATH_EXPORTS "/etc/exports"
*/
#define _PATH_EXECDIR "/sbin"
#define _PATH_EXPORTS "/etc/exports"
+#define _PATH_MOUNTDPID "/var/run/mountd.pid"