From 44ad8faef31d35a4f2ad8d0d0f8326dff3da94ab Mon Sep 17 00:00:00 2001 From: matusita Date: Sun, 11 Nov 2001 12:16:50 +0000 Subject: [PATCH] One more fix for sysinstall/libdisk to create a device file if and only if a target directory is devfs. Previous patch doesn't correct, it's unconditionally avoid to create a device file if kernel knows devfs. PR: 31109 --- lib/libdisk/create_chunk.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/libdisk/create_chunk.c b/lib/libdisk/create_chunk.c index f87fc1dfed85..fe8e5298b132 100644 --- a/lib/libdisk/create_chunk.c +++ b/lib/libdisk/create_chunk.c @@ -17,10 +17,10 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include -#include +#include #include #include #include @@ -282,18 +282,22 @@ MakeDev(struct chunk *c1, const char *path) char buf[BUFSIZ], buf2[BUFSIZ]; struct group *grp; struct passwd *pwd; + struct statfs fs; uid_t owner; gid_t group; - int mib[4]; - size_t miblen; *buf2 = '\0'; - miblen = sizeof(mib)/sizeof(mib[0]); if (isDebug()) msgDebug("MakeDev: Called with %s on path %s\n", p, path); if (!strcmp(p, "X")) return 0; - if (!sysctlnametomib("vfs.devfs.generation", &mib, &miblen)) { + if (statfs(path, &fs) != 0) { +#ifdef DEBUG + warn("statfs(%s) failed\n", path); +#endif + return 0; + } + if (strcmp(fs.f_fstypename, "devfs") == 0) { if (isDebug()) msgDebug("MakeDev: No need to mknod(2) with DEVFS.\n"); return 1;