Merge pull request #450 from lnussel/master
useradd: assume uid 0 == root as fallback
This commit is contained in:
commit
535f54076c
@ -2507,14 +2507,14 @@ int main (int argc, char **argv)
|
||||
{
|
||||
struct passwd *pampw;
|
||||
pampw = getpwuid (getuid ()); /* local, no need for xgetpwuid */
|
||||
if (pampw == NULL) {
|
||||
if (pampw == NULL && getuid ()) {
|
||||
fprintf (stderr,
|
||||
_("%s: Cannot determine your user name.\n"),
|
||||
Prog);
|
||||
fail_exit (1);
|
||||
}
|
||||
|
||||
retval = pam_start ("useradd", pampw->pw_name, &conv, &pamh);
|
||||
retval = pam_start ("useradd", pampw?pampw->pw_name:"root", &conv, &pamh);
|
||||
}
|
||||
|
||||
if (PAM_SUCCESS == retval) {
|
||||
|
Loading…
Reference in New Issue
Block a user