diff options
author | matusita <matusita@FreeBSD.org> | 2001-11-11 12:16:50 +0000 |
---|---|---|
committer | matusita <matusita@FreeBSD.org> | 2001-11-11 12:16:50 +0000 |
commit | 44ad8faef31d35a4f2ad8d0d0f8326dff3da94ab (patch) | |
tree | 98ff765190874c802ba01a7815880f10f275b2b8 /lib | |
parent | 147fa615f3f983843e22b96c01e7433cb1702754 (diff) | |
download | FreeBSD-src-44ad8faef31d35a4f2ad8d0d0f8326dff3da94ab.zip FreeBSD-src-44ad8faef31d35a4f2ad8d0d0f8326dff3da94ab.tar.gz |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libdisk/create_chunk.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/libdisk/create_chunk.c b/lib/libdisk/create_chunk.c index f87fc1d..fe8e529 100644 --- a/lib/libdisk/create_chunk.c +++ b/lib/libdisk/create_chunk.c @@ -17,10 +17,10 @@ __FBSDID("$FreeBSD$"); #include <ctype.h> #include <fcntl.h> #include <stdarg.h> -#include <sys/types.h> +#include <sys/param.h> #include <sys/disklabel.h> #include <sys/diskslice.h> -#include <sys/types.h> +#include <sys/mount.h> #include <sys/stat.h> #include <sys/sysctl.h> #include <grp.h> @@ -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; |