summaryrefslogtreecommitdiffstats
path: root/sbin/newfs
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2005-08-14 17:07:04 +0000
committeriedowse <iedowse@FreeBSD.org>2005-08-14 17:07:04 +0000
commitd5c0a5cf5d581d82844dabcea3bd73861df7ba13 (patch)
treed45ed2f8896f264b8426b47bc31960a8e902d839 /sbin/newfs
parentf8b8e82885c0f48bb4d7fbe5ce85bcab7508533c (diff)
downloadFreeBSD-src-d5c0a5cf5d581d82844dabcea3bd73861df7ba13.zip
FreeBSD-src-d5c0a5cf5d581d82844dabcea3bd73861df7ba13.tar.gz
Don't treat failure to find the operator GID as a fatal error; this
made it impossible to use newfs (and mdmfs) when /etc/group is missing and /etc is read-only.
Diffstat (limited to 'sbin/newfs')
-rw-r--r--sbin/newfs/mkfs.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c
index 0b653d5..2090685 100644
--- a/sbin/newfs/mkfs.c
+++ b/sbin/newfs/mkfs.c
@@ -748,11 +748,16 @@ fsinit(time_t utime)
{
union dinode node;
struct group *grp;
+ gid_t gid;
int entries;
memset(&node, 0, sizeof node);
- if ((grp = getgrnam("operator")) == NULL)
- errx(35, "Cannot retrieve operator gid");
+ if ((grp = getgrnam("operator")) != NULL) {
+ gid = grp->gr_gid;
+ } else {
+ warnx("Cannot retrieve operator gid.");
+ gid = 0;
+ }
entries = (nflag) ? ROOTLINKCNT - 1: ROOTLINKCNT;
if (sblock.fs_magic == FS_UFS1_MAGIC) {
/*
@@ -778,7 +783,7 @@ fsinit(time_t utime)
* create the .snap directory
*/
node.dp1.di_mode |= 020;
- node.dp1.di_gid = grp->gr_gid;
+ node.dp1.di_gid = gid;
node.dp1.di_nlink = SNAPLINKCNT;
node.dp1.di_size = makedir(snap_dir, SNAPLINKCNT);
node.dp1.di_db[0] =
@@ -814,7 +819,7 @@ fsinit(time_t utime)
* create the .snap directory
*/
node.dp2.di_mode |= 020;
- node.dp2.di_gid = grp->gr_gid;
+ node.dp2.di_gid = gid;
node.dp2.di_nlink = SNAPLINKCNT;
node.dp2.di_size = makedir(snap_dir, SNAPLINKCNT);
node.dp2.di_db[0] =
OpenPOWER on IntegriCloud