+2010-03-11 Nicolas François <nicolas.francois@centraliens.net>
+
+ * 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 <nicolas.francois@centraliens.net>
* src/vipw.c: Document the sections closed by #endif
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);
}
}
#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);
}