summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1995-06-13 17:42:07 +0000
committerwollman <wollman@FreeBSD.org>1995-06-13 17:42:07 +0000
commit5d8d0d552aa45b4185e90cbaae4791dca1856acb (patch)
treee57647e5c99f79289dd6071145c1e50ad834684e
parent1650d219a26c43938ef0cc5d91d3d8328069fff8 (diff)
downloadFreeBSD-src-5d8d0d552aa45b4185e90cbaae4791dca1856acb.zip
FreeBSD-src-5d8d0d552aa45b4185e90cbaae4791dca1856acb.tar.gz
Use the correct file pointer when reading the group id map file. The old
code tried to read the group id map from the user id file, and thus would never actually allow a umapfs to be mounted. (!)
-rw-r--r--sbin/mount_umap/mount_umap.c13
-rw-r--r--sbin/mount_umapfs/mount_umapfs.c13
2 files changed, 16 insertions, 10 deletions
diff --git a/sbin/mount_umap/mount_umap.c b/sbin/mount_umap/mount_umap.c
index c7e31c6..f8e229b 100644
--- a/sbin/mount_umap/mount_umap.c
+++ b/sbin/mount_umap/mount_umap.c
@@ -190,7 +190,7 @@ main(argc, argv)
errx(1, "%s does not belong to root%s", gmapfile, not);
#endif /* MAPSECURITY */
- if ((fscanf(fp, "%d\n", &gnentries)) != 1)
+ if ((fscanf(gfp, "%d\n", &gnentries)) != 1)
errx(1, "nentries not found%s", gmapfile, not);
if (gnentries > MAPFILEENTRIES)
errx(1,
@@ -200,11 +200,11 @@ main(argc, argv)
#endif
for (count = 0; count < gnentries; ++count)
- if ((fscanf(fp, "%lu %lu\n",
+ if ((fscanf(gfp, "%lu %lu\n",
&(gmapdata[count][0]), &(gmapdata[count][1]))) != 2) {
- if (ferror(fp))
+ if (ferror(gfp))
err(1, "%s%s", gmapfile, not);
- if (feof(fp))
+ if (feof(gfp))
errx(1, "%s: unexpected end-of-file%s",
gmapfile, not);
errx(1, "%s: illegal format (line %d)%s",
@@ -226,8 +226,11 @@ main(argc, argv)
endvfsent(); /* flush cache */
vfc = getvfsbyname("umap");
}
+ if (!vfc) {
+ errx(1, "umap filesystem not available");
+ }
- if (mount(vfc ? vfc->vfc_index : MOUNT_UMAP, argv[1], mntflags, &args))
+ if (mount(vfc->vfc_index, argv[1], mntflags, &args))
err(1, NULL);
exit(0);
}
diff --git a/sbin/mount_umapfs/mount_umapfs.c b/sbin/mount_umapfs/mount_umapfs.c
index c7e31c6..f8e229b 100644
--- a/sbin/mount_umapfs/mount_umapfs.c
+++ b/sbin/mount_umapfs/mount_umapfs.c
@@ -190,7 +190,7 @@ main(argc, argv)
errx(1, "%s does not belong to root%s", gmapfile, not);
#endif /* MAPSECURITY */
- if ((fscanf(fp, "%d\n", &gnentries)) != 1)
+ if ((fscanf(gfp, "%d\n", &gnentries)) != 1)
errx(1, "nentries not found%s", gmapfile, not);
if (gnentries > MAPFILEENTRIES)
errx(1,
@@ -200,11 +200,11 @@ main(argc, argv)
#endif
for (count = 0; count < gnentries; ++count)
- if ((fscanf(fp, "%lu %lu\n",
+ if ((fscanf(gfp, "%lu %lu\n",
&(gmapdata[count][0]), &(gmapdata[count][1]))) != 2) {
- if (ferror(fp))
+ if (ferror(gfp))
err(1, "%s%s", gmapfile, not);
- if (feof(fp))
+ if (feof(gfp))
errx(1, "%s: unexpected end-of-file%s",
gmapfile, not);
errx(1, "%s: illegal format (line %d)%s",
@@ -226,8 +226,11 @@ main(argc, argv)
endvfsent(); /* flush cache */
vfc = getvfsbyname("umap");
}
+ if (!vfc) {
+ errx(1, "umap filesystem not available");
+ }
- if (mount(vfc ? vfc->vfc_index : MOUNT_UMAP, argv[1], mntflags, &args))
+ if (mount(vfc->vfc_index, argv[1], mntflags, &args))
err(1, NULL);
exit(0);
}
OpenPOWER on IntegriCloud