svn commit: r247042 - head/usr.sbin/makefs
Brooks Davis
brooks at FreeBSD.org
Wed Feb 20 15:25:42 UTC 2013
Author: brooks
Date: Wed Feb 20 15:25:40 2013
New Revision: 247042
URL: http://svnweb.freebsd.org/changeset/base/247042
Log:
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
Modified:
head/usr.sbin/makefs/mtree.c
Modified: head/usr.sbin/makefs/mtree.c
==============================================================================
--- head/usr.sbin/makefs/mtree.c Wed Feb 20 15:18:42 2013 (r247041)
+++ head/usr.sbin/makefs/mtree.c Wed Feb 20 15:25:40 2013 (r247042)
@@ -508,8 +508,8 @@ read_mtree_keywords(FILE *fp, fsnode *no
{
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 *no
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 *no
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;
More information about the svn-src-head
mailing list