diff --git a/lib/libdisk/create_chunk.c b/lib/libdisk/create_chunk.c index f87fc1dfed8..fe8e5298b13 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;