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.
This commit is contained in:
Ian Dowse 2005-08-14 17:07:04 +00:00
parent 5b5a030fa4
commit 9405aea2e2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=149048

View File

@ -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] =