aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2013-02-20 15:25:40 +0000
committerBrooks Davis <brooks@FreeBSD.org>2013-02-20 15:25:40 +0000
commite9a03238b07457697468a52a46c6f31b178a71bc (patch)
treec2a06dd246b9314e504f2834c38916c7376e9cef
parentb0d9adde8024d1d067bbf905fd6a4f30b1560e62 (diff)
downloadsrc-e9a03238b07457697468a52a46c6f31b178a71bc.tar.gz
src-e9a03238b07457697468a52a46c6f31b178a71bc.zip
Fix the -N option in manifest mode by using pwcache(3). This also
speeds up image creation appreciably. Reviewed by: marcel Sponsored by: DARPA, AFRL
Notes
Notes: svn path=/head/; revision=247042
-rw-r--r--usr.sbin/makefs/mtree.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/usr.sbin/makefs/mtree.c b/usr.sbin/makefs/mtree.c
index f5eb5fc8cf85..12893df26cec 100644
--- a/usr.sbin/makefs/mtree.c
+++ b/usr.sbin/makefs/mtree.c
@@ -508,8 +508,8 @@ read_mtree_keywords(FILE *fp, fsnode *node)
{
char keyword[PATH_MAX];
char *name, *p, *value;
- struct group *grent;
- struct passwd *pwent;
+ gid_t gid;
+ uid_t uid;
struct stat *st, sb;
intmax_t num;
u_long flset, flclr;
@@ -585,11 +585,10 @@ read_mtree_keywords(FILE *fp, fsnode *node)
error = ENOATTR;
break;
}
- grent = getgrnam(value);
- if (grent != NULL)
- st->st_gid = grent->gr_gid;
+ if (gid_from_group(value, &gid) == 0)
+ st->st_gid = gid;
else
- error = errno;
+ error = EINVAL;
} else
error = ENOSYS;
break;
@@ -698,11 +697,10 @@ read_mtree_keywords(FILE *fp, fsnode *node)
error = ENOATTR;
break;
}
- pwent = getpwnam(value);
- if (pwent != NULL)
- st->st_uid = pwent->pw_uid;
+ if (uid_from_user(value, &uid) == 0)
+ st->st_uid = uid;
else
- error = errno;
+ error = EINVAL;
} else
error = ENOSYS;
break;