* src/pwck.c: Re-indent.

This commit is contained in:
nekral-guest
2010-03-18 09:33:55 +00:00
parent a996fac57b
commit f77e9d0d80
2 changed files with 56 additions and 31 deletions

View File

@ -1,4 +1,8 @@
2010-03-17 Nicolas François <nicolas.francois@centraliens.net>
2010-03-18 Nicolas François <nicolas.francois@centraliens.net>
* src/pwck.c: Re-indent.
2010-03-18 Nicolas François <nicolas.francois@centraliens.net>
* src/userdel.c, src/usermod.c, src/vipw.c, src/useradd.c,
src/pwck.c, src/chage.c, lib/shadowio.c: Explicitly use the

View File

@ -243,7 +243,8 @@ static void open_files (void)
fprintf (stderr, _("%s: cannot open %s\n"),
Prog, spw_dbname ());
if (use_system_spw_file) {
SYSLOG ((LOG_WARN, "cannot open %s", spw_dbname()));
SYSLOG ((LOG_WARN, "cannot open %s",
spw_dbname ()));
}
fail_exit (E_CANTOPEN);
}
@ -266,16 +267,22 @@ static void close_files (bool changed)
*/
if (changed) {
if (pw_opened && pw_close () == 0) {
fprintf (stderr, _("%s: failure while writing changes to %s\n"),
fprintf (stderr,
_("%s: failure while writing changes to %s\n"),
Prog, pwd_file);
SYSLOG ((LOG_ERR, "failure while writing changes to %s", pwd_file));
SYSLOG ((LOG_ERR,
"failure while writing changes to %s",
pwd_file));
fail_exit (E_CANTUPDATE);
}
pw_opened = false;
if (is_shadow && spw_opened && (spw_close () == 0)) {
fprintf (stderr, _("%s: failure while writing changes to %s\n"),
fprintf (stderr,
_("%s: failure while writing changes to %s\n"),
Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_dbname()));
SYSLOG ((LOG_ERR,
"failure while writing changes to %s",
spw_dbname ()));
fail_exit (E_CANTUPDATE);
}
spw_opened = false;
@ -470,8 +477,10 @@ static void check_pw_file (int *errors, bool *changed)
#ifdef WITH_TCB
if (getdef_bool ("USE_TCB")) {
if (shadowtcb_set_user (pwd->pw_name) == SHADOWTCB_FAILURE) {
printf(_("no tcb directory for %s\n"), pwd->pw_name);
printf(_("create tcb directory for %s?"), pwd->pw_name);
printf (_("no tcb directory for %s\n"),
pwd->pw_name);
printf (_("create tcb directory for %s?"),
pwd->pw_name);
*errors += 1;
if (yes_or_no (read_only)) {
if (shadowtcb_create (pwd->pw_name, pwd->pw_uid) == SHADOWTCB_FAILURE) {
@ -492,12 +501,17 @@ static void check_pw_file (int *errors, bool *changed)
}
spw_locked = true;
if (spw_open (read_only ? O_RDONLY : O_RDWR) == 0) {
fprintf (stderr, _("%s: cannot open %s\n"),
fprintf (stderr,
_("%s: cannot open %s\n"),
Prog, spw_dbname ());
*errors += 1;
if (spw_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
fprintf (stderr,
_("%s: failed to unlock %s\n"),
Prog, spw_dbname ());
SYSLOG ((LOG_ERR,
"failed to unlock %s",
spw_dbname ()));
}
continue;
}
@ -564,16 +578,23 @@ static void check_pw_file (int *errors, bool *changed)
}
#ifdef WITH_TCB
if (getdef_bool ("USE_TCB") && spw_locked) {
if (spw_opened && spw_close () == 0) {
fprintf (stderr, _("%s: failure while writing changes to %s\n"),
if (spw_opened && (spw_close () == 0)) {
fprintf (stderr,
_("%s: failure while writing changes to %s\n"),
Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_dbname()));
SYSLOG ((LOG_ERR,
"failure while writing changes to %s",
spw_dbname ()));
} else {
spw_opened = false;
}
if (spw_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
fprintf (stderr,
_("%s: failed to unlock %s\n"),
Prog, spw_dbname ());
SYSLOG ((LOG_ERR,
"failed to unlock %s",
spw_dbname ()));
} else {
spw_locked = false;
}