libpwdgrp: use getpwent() instead of getpwent_r()
[oweals/busybox.git] / loginutils / deluser.c
index 2d98ecc58f43af3e06a6dcb0bb8cd4d727cc3c76..01a9386bc577377f8db866c2452b736178f0552d 100644 (file)
@@ -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();
                        }