diff options
author | mux <mux@FreeBSD.org> | 2002-08-03 16:21:33 +0000 |
---|---|---|
committer | mux <mux@FreeBSD.org> | 2002-08-03 16:21:33 +0000 |
commit | ba55503fcc9127daf4ff5f3448c757281deb0e4c (patch) | |
tree | 1004d646ba111aa60ace74badb15d7eaed173851 /sbin/init/init.c | |
parent | f72ce2f014de34b8615290f44d408be01938dd02 (diff) | |
download | FreeBSD-src-ba55503fcc9127daf4ff5f3448c757281deb0e4c.zip FreeBSD-src-ba55503fcc9127daf4ff5f3448c757281deb0e4c.tar.gz |
I should have committed this ages ago...
Convert init(8) to use nmount() instead of mount() when
it has to mount devfs. This doesn't happen normally,
since the kernel is supposed to mount devfs itself.
Diffstat (limited to 'sbin/init/init.c')
-rw-r--r-- | sbin/init/init.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sbin/init/init.c b/sbin/init/init.c index 6d3ecad..9a1cd68 100644 --- a/sbin/init/init.c +++ b/sbin/init/init.c @@ -54,6 +54,7 @@ static const char rcsid[] = #include <sys/sysctl.h> #include <sys/wait.h> #include <sys/stat.h> +#include <sys/uio.h> #include <db.h> #include <errno.h> @@ -278,9 +279,16 @@ invalid: warning("ignoring excess arguments"); if (devfs) { + struct iovec iov[4]; char *s; int i; + iov[0].iov_base = "fstype"; + iov[0].iov_len = sizeof("fstype"); + iov[1].iov_base = "devfs"; + iov[1].iov_len = sizeof("devfs"); + iov[2].iov_base = "fspath"; + iov[2].iov_len = sizeof("fspath"); /* * Try to avoid the trailing slash in _PATH_DEV. * Be *very* defensive. @@ -290,11 +298,15 @@ invalid: i = strlen(s); if (i > 0 && s[i - 1] == '/') s[i - 1] = '\0'; - mount("devfs", s, 0, 0); - free(s); + iov[3].iov_base = s; + iov[3].iov_len = strlen(s) + 1; } else { - mount("devfs", _PATH_DEV, 0, 0); + iov[3].iov_base = _PATH_DEV; + iov[3].iov_len = sizeof(_PATH_DEV); } + nmount(iov, 4, 0); + if (s != NULL) + free(s); } /* |