groupdel: fix SIGSEGV when passwd does not exist

When using groupdel with a prefix, groupdel will attempt to read a
passwd file to look for any user in the group. When the file does not
exist it cores with segmentation fault.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1986111
This commit is contained in:
François Rigault 2021-11-01 13:54:25 +01:00
parent 387da46d73
commit a757b458ff
1 changed files with 3 additions and 0 deletions

View File

@ -288,6 +288,9 @@ extern struct passwd* prefix_getpwent()
if (!passwd_db_file) {
return getpwent();
}
if (!fp_pwent) {
return NULL;
}
return fgetpwent(fp_pwent);
}
extern void prefix_endpwent()