From: nekral-guest Date: Thu, 11 Mar 2010 22:03:45 +0000 (+0000) Subject: * src/useradd.c: Re-indent. X-Git-Tag: 4.1.5~350 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ad6730687f396c1045f1c97a25f6f9e225ef3e8d;p=shadow * src/useradd.c: Re-indent. * src/useradd.c: Added brackets. * src/useradd.c: Avoid implicit conversion of integers to booleans. * src/useradd.c: Harmonize error messages. --- diff --git a/ChangeLog b/ChangeLog index 66e95536..737128df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-03-11 Nicolas François + + * src/useradd.c: Re-indent. + * src/useradd.c: Added brackets. + * src/useradd.c: Avoid implicit conversion of integers to + booleans. + * src/useradd.c: Harmonize error messages. + 2010-03-11 Nicolas François * src/vipw.c: Document the sections closed by #endif diff --git a/src/useradd.c b/src/useradd.c index cd83ad9e..5715c626 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -1471,20 +1471,21 @@ static void open_files (void) static void open_shadow (void) { - if (!is_shadow_pwd) + if (!is_shadow_pwd) { return; - if (!spw_lock ()) { - fprintf(stderr, - _("%s: cannot lock shadow password file\n"), - Prog); - fail_exit(E_PW_UPDATE); + } + if (spw_lock () == 0) { + fprintf (stderr, + _("%s: cannot lock %s; try again later.\n"), + Prog, spw_dbname ()); + fail_exit (E_PW_UPDATE); } spw_locked = true; - if (!spw_open (O_RDWR)) { - fprintf(stderr, - _("%s: cannot open shadow password file\n"), - Prog); - fail_exit(E_PW_UPDATE); + if (spw_open (O_RDWR) == 0) { + fprintf (stderr, + _("%s: cannot open %s\n"), + Prog, spw_dbname ()); + fail_exit (E_PW_UPDATE); } } @@ -2002,7 +2003,7 @@ int main (int argc, char **argv) #ifdef WITH_TCB if (getdef_bool("USE_TCB")) { - if (!shadowtcb_create(user_name, user_id)) { + if (shadowtcb_create(user_name, user_id) == 0) { fprintf(stderr, "Failed to create tcb directory for %s\n", user_name); fail_exit (E_UID_IN_USE); }