]> git.ipfire.org Git - thirdparty/shadow.git/commit
newusers: Add missing error handling
authorAlejandro Colomar <alx@kernel.org>
Sat, 4 Feb 2023 19:52:54 +0000 (20:52 +0100)
committerSerge Hallyn <serge@hallyn.com>
Fri, 26 May 2023 02:22:08 +0000 (21:22 -0500)
commit1957c8c881e232843a8d1617d66f223bf1e229c9
treef6511a250e84ab6b464c698e5205a58d20148726
parent6491fef1e0be72661aa8ed60d3784d4426f41c76
newusers: Add missing error handling

Some errors were being reported in stderr, but then they weren't really
being treated as errors.

If mkdir(2) for EEXIST, it's possible that the sysadmin pre-created the
user dir; don't fail.  However, let's keep a log line, for having some
notice that it happened.

Also, run chmod(2) if mkdir(2) failed for EEXIST (so transform the
'else if' into an 'if').

Cc: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
src/newusers.c