From 1f083b1e3d54c411d44107ee256fa08393f9f14c Mon Sep 17 00:00:00 2001 From: Maxime Henrion Date: Sat, 3 Aug 2002 16:21:33 +0000 Subject: [PATCH] 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. --- sbin/init/init.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/sbin/init/init.c b/sbin/init/init.c index 6d3ecadc8c40..9a1cd6839de1 100644 --- a/sbin/init/init.c +++ b/sbin/init/init.c @@ -54,6 +54,7 @@ static const char rcsid[] = #include #include #include +#include #include #include @@ -278,9 +279,16 @@ main(int argc, char *argv[]) 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 @@ main(int argc, char *argv[]) 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); } /*