Skip to content

Commit

Permalink
Merge pull request shadow-maint#392 from hallyn/2021-07-25/useradd-de…
Browse files Browse the repository at this point in the history
…faults

useradd: create /etc/default saving defaults.
  • Loading branch information
Christian Brauner committed Jul 26, 2021
2 parents cd551ef + 33c33a3 commit 065aae6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/useradd.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,14 @@ static int set_defaults (void)
assert (wlen == (int) len -1);
}

ret = mkdir(dirname(NEW_USER_FILE), 0755);
if (-1 == ret && EEXIST != errno) {
fprintf (stderr,
_("%s: cannot create directory for defaults file\n"),
Prog);
goto setdef_err;
}

/*
* Create a temporary file to copy the new output to.
*/
Expand Down

0 comments on commit 065aae6

Please sign in to comment.