From 23cfaab47de7392c1ba7d601a05fb36da3629b28 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 7 Feb 2015 21:21:02 +0100 Subject: libpwdgrp: use getpwent() instead of getpwent_r() function old new delta massage_data_for_non_r_func - 90 +90 bb_internal_getpwent - 69 +69 getXXnam_r 94 162 +68 fill_bounds 131 128 -3 deluser_main 355 310 -45 complete_username 123 78 -45 getXXnam 163 90 -73 massage_data_for_r_func 103 - -103 bb_internal_getpwent_r 121 - -121 ------------------------------------------------------------------------------ (add/remove: 2/2 grow/shrink: 1/5 up/down: 227/-407) Total: -163 bytes Signed-off-by: Denys Vlasenko --- loginutils/deluser.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'loginutils') diff --git a/loginutils/deluser.c b/loginutils/deluser.c index 2d98ecc58..01a9386bc 100644 --- a/loginutils/deluser.c +++ b/loginutils/deluser.c @@ -91,12 +91,11 @@ int deluser_main(int argc, char **argv) if (!member) { /* "delgroup GROUP" */ struct passwd *pw; - struct passwd pwent; /* Check if the group is in use */ -#define passwd_buf bb_common_bufsiz1 - while (!getpwent_r(&pwent, passwd_buf, sizeof(passwd_buf), &pw)) { - if (pwent.pw_gid == gr->gr_gid) - bb_error_msg_and_die("'%s' still has '%s' as their primary group!", pwent.pw_name, name); + while ((pw = getpwent()) != NULL) { + if (pw->pw_gid == gr->gr_gid) + bb_error_msg_and_die("'%s' still has '%s' as their primary group!", + pw->pw_name, name); } //endpwent(); } -- cgit v1.2.3