diff options
author | Denis Vlasenko | 2008-12-05 16:23:06 +0000 |
---|---|---|
committer | Denis Vlasenko | 2008-12-05 16:23:06 +0000 |
commit | 15437e3e2a0cc9e4ba25066fd562b2862d38799b (patch) | |
tree | 5093eddb8a8dd3ae6edd564e43f6219be3fd9a08 /libbb | |
parent | d324e1b808daca7eec5b8700824a886a21508714 (diff) | |
download | busybox-15437e3e2a0cc9e4ba25066fd562b2862d38799b.zip busybox-15437e3e2a0cc9e4ba25066fd562b2862d38799b.tar.gz |
libbb: add xgetgrnam too. ~0 code size change
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/bb_pwd.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libbb/bb_pwd.c b/libbb/bb_pwd.c index 5dbc58d..d728577 100644 --- a/libbb/bb_pwd.c +++ b/libbb/bb_pwd.c @@ -23,7 +23,14 @@ struct passwd* FAST_FUNC xgetpwnam(const char *name) return pw; } -/* xgetgrnam too? */ +struct group* FAST_FUNC xgetgrnam(const char *name) +{ + struct group *gr = getgrnam(name); + if (!gr) + bb_error_msg_and_die("unknown group %s", name); + return gr; +} + struct passwd* FAST_FUNC xgetpwuid(uid_t uid) { @@ -89,10 +96,7 @@ long FAST_FUNC xgroup2gid(const char *name) { struct group *mygroup; - mygroup = getgrnam(name); - if (mygroup == NULL) - bb_error_msg_and_die("unknown group %s", name); - + mygroup = xgetgrnam(name); return mygroup->gr_gid; } |