* libmisc/obscure.c, lib/prototypes.h (obscure): Return a bool

instead of an int.
	* libmisc/obscure.c, libmisc/tz.c, src/passwd.c, lib/encrypt.c,
	libmisc/copydir.c, lib/prototypes.h: Add splint annotations.
	* libmisc/tz.c: Fix some const issues.
	* libmisc/tz.c: Avoid multi-statements lines.
	* libmisc/tz.c: Add brackets.
	* libmisc/copydir.c: Do not check *printf/*puts return value.
	* libmisc/copydir.c: Fail if we cannot set or reset the SELinux
	fscreate context.
	* libmisc/copydir.c: Use xmalloc instead of malloc.
	* libmisc/copydir.c: Do not check lutimes return value
	* src/vipw.c: Avoid implicit conversion of integer to boolean.
	* src/su.c (iswheel): Return a bool instead of an int.
	* src/passwd.c: Remove insert_crypt_passwd(). Use xstrdup instead.
	* src/passwd.c: Return constant strings when sufficient.
	* src/passwd.c: Do not check *printf/*puts return value.
	* src/passwd.c: Avoid implicit conversion of character to boolean.
	* src/passwd.c: Do not check sleep return value.
	* src/sulogin.c: Do not check *printf/*puts return value.
	* lib/encrypt.c: Do not check fprintf return value.
This commit is contained in:
nekral-guest
2010-08-22 12:49:07 +00:00
parent 7e398a169b
commit 471a2df3a6
10 changed files with 222 additions and 175 deletions

View File

@@ -131,20 +131,19 @@ static bool do_update_pwd = false;
*/
/* local function prototypes */
static void usage (int);
static /*@noreturn@*/void usage (int);
#ifndef USE_PAM
static int reuse (const char *, const struct passwd *);
static bool reuse (const char *, const struct passwd *);
static int new_password (const struct passwd *);
static void check_password (const struct passwd *, const struct spwd *);
static char *insert_crypt_passwd (const char *, const char *);
#endif /* !USE_PAM */
static char *date_to_str (time_t);
static const char *pw_status (const char *);
static /*@observer@*/const char *date_to_str (time_t);
static /*@observer@*/const char *pw_status (const char *);
static void print_status (const struct passwd *);
static void fail_exit (int);
static void oom (void);
static /*@noreturn@*/void fail_exit (int);
static /*@noreturn@*/void oom (void);
static char *update_crypt_pw (char *);
static void update_noshadow (void);
@@ -158,8 +157,9 @@ static int check_selinux_access (const char *changed_user,
/*
* usage - print command usage and exit
*/
static void usage (int status)
static /*@noreturn@*/void usage (int status)
{
(void)
fputs (_("Usage: passwd [options] [LOGIN]\n"
"\n"
"Options:\n"
@@ -185,7 +185,7 @@ static void usage (int status)
}
#ifndef USE_PAM
static int reuse (const char *pass, const struct passwd *pw)
static bool reuse (const char *pass, const struct passwd *pw)
{
#ifdef HAVE_LIBCRACK_HIST
const char *reason;
@@ -200,11 +200,11 @@ static int reuse (const char *pass, const struct passwd *pw)
reason = FascistHistory (pass, pw->pw_uid);
#endif /* !HAVE_LIBCRACK_PW */
if (NULL != reason) {
printf (_("Bad password: %s. "), reason);
return 1;
(void) printf (_("Bad password: %s. "), reason);
return true;
}
#endif /* HAVE_LIBCRACK_HIST */
return 0;
return false;
}
/*
@@ -219,7 +219,7 @@ static int new_password (const struct passwd *pw)
char orig[200]; /* Original password */
char pass[200]; /* New password */
int i; /* Counter for retries */
int warned;
bool warned;
int pass_max_len = -1;
const char *method;
@@ -232,7 +232,7 @@ static int new_password (const struct passwd *pw)
* password.
*/
if (!amroot && crypt_passwd[0]) {
if (!amroot && ('\0' != crypt_passwd[0])) {
clear = getpass (_("Old password: "));
if (NULL == clear) {
return -1;
@@ -240,12 +240,14 @@ static int new_password (const struct passwd *pw)
cipher = pw_encrypt (clear, crypt_passwd);
if (strcmp (cipher, crypt_passwd) != 0) {
strzero (clear);
strzero (cipher);
SYSLOG ((LOG_WARN, "incorrect password for %s",
pw->pw_name));
sleep (1);
fprintf (stderr,
_("Incorrect password for %s.\n"),
pw->pw_name);
pw->pw_name));
(void) sleep (1);
(void) fprintf (stderr,
_("Incorrect password for %s.\n"),
pw->pw_name);
return -1;
}
STRFCPY (orig, clear);
@@ -280,19 +282,19 @@ static int new_password (const struct passwd *pw)
}
if (!qflg) {
if (pass_max_len == -1) {
printf (_(
(void) printf (_(
"Enter the new password (minimum of %d characters)\n"
"Please use a combination of upper and lower case letters and numbers.\n"),
getdef_num ("PASS_MIN_LEN", 5));
} else {
printf (_(
(void) printf (_(
"Enter the new password (minimum of %d, maximum of %d characters)\n"
"Please use a combination of upper and lower case letters and numbers.\n"),
getdef_num ("PASS_MIN_LEN", 5), pass_max_len);
}
}
warned = 0;
warned = false;
for (i = getdef_num ("PASS_CHANGE_TRIES", 5); i > 0; i--) {
cp = getpass (_("New password: "));
if (NULL == cp) {
@@ -300,13 +302,13 @@ static int new_password (const struct passwd *pw)
return -1;
}
if (warned && (strcmp (pass, cp) != 0)) {
warned = 0;
warned = false;
}
STRFCPY (pass, cp);
strzero (cp);
if (!amroot && (!obscure (orig, pass, pw) || reuse (pass, pw))) {
puts (_("Try again."));
(void) puts (_("Try again."));
continue;
}
@@ -317,8 +319,8 @@ static int new_password (const struct passwd *pw)
*/
if (amroot && !warned && getdef_bool ("PASS_ALWAYS_WARN")
&& (!obscure (orig, pass, pw) || reuse (pass, pw))) {
puts (_("\nWarning: weak password (enter it again to use it anyway)."));
warned++;
(void) puts (_("\nWarning: weak password (enter it again to use it anyway)."));
warned = true;
continue;
}
cp = getpass (_("Re-enter new password: "));
@@ -327,7 +329,7 @@ static int new_password (const struct passwd *pw)
return -1;
}
if (strcmp (cp, pass) != 0) {
fputs (_("They don't match; try again.\n"), stderr);
(void) fputs (_("They don't match; try again.\n"), stderr);
} else {
strzero (cp);
break;
@@ -393,9 +395,9 @@ static void check_password (const struct passwd *pw, const struct spwd *sp)
|| (exp_status > 1)
|| ( (sp->sp_max >= 0)
&& (sp->sp_min > sp->sp_max))) {
fprintf (stderr,
_("The password for %s cannot be changed.\n"),
sp->sp_namp);
(void) fprintf (stderr,
_("The password for %s cannot be changed.\n"),
sp->sp_namp);
SYSLOG ((LOG_WARN, "password locked for '%s'", sp->sp_namp));
closelog ();
exit (E_NOPERM);
@@ -410,42 +412,33 @@ static void check_password (const struct passwd *pw, const struct spwd *sp)
ok = last + (sp->sp_min > 0 ? sp->sp_min * SCALE : 0);
if (now < ok) {
fprintf (stderr,
_("The password for %s cannot be changed yet.\n"),
pw->pw_name);
(void) fprintf (stderr,
_("The password for %s cannot be changed yet.\n"),
pw->pw_name);
SYSLOG ((LOG_WARN, "now < minimum age for '%s'", pw->pw_name));
closelog ();
exit (E_NOPERM);
}
}
}
/*
* insert_crypt_passwd - add an "old-style" password to authentication
* string result now malloced to avoid overflow, just in case. --marekm
*/
static char *insert_crypt_passwd (const char *string, const char *passwd)
{
return xstrdup (passwd);
}
#endif /* !USE_PAM */
static char *date_to_str (time_t t)
static /*@observer@*/const char *date_to_str (time_t t)
{
static char buf[80];
struct tm *tm;
tm = gmtime (&t);
#ifdef HAVE_STRFTIME
strftime (buf, sizeof buf, "%m/%d/%Y", tm);
(void) strftime (buf, sizeof buf, "%m/%d/%Y", tm);
#else /* !HAVE_STRFTIME */
snprintf (buf, sizeof buf, "%02d/%02d/%04d",
tm->tm_mon + 1, tm->tm_mday, tm->tm_year + 1900);
(void) snprintf (buf, sizeof buf, "%02d/%02d/%04d",
tm->tm_mon + 1, tm->tm_mday, tm->tm_year + 1900);
#endif /* !HAVE_STRFTIME */
return buf;
}
static const char *pw_status (const char *pass)
static /*@observer@*/const char *pw_status (const char *pass)
{
if (*pass == '*' || *pass == '!') {
return "L";
@@ -465,25 +458,26 @@ static void print_status (const struct passwd *pw)
sp = getspnam (pw->pw_name); /* local, no need for xgetspnam */
if (NULL != sp) {
printf ("%s %s %s %ld %ld %ld %ld\n",
pw->pw_name,
pw_status (sp->sp_pwdp),
date_to_str (sp->sp_lstchg * SCALE),
(sp->sp_min * SCALE) / DAY,
(sp->sp_max * SCALE) / DAY,
(sp->sp_warn * SCALE) / DAY,
(sp->sp_inact * SCALE) / DAY);
(void) printf ("%s %s %s %ld %ld %ld %ld\n",
pw->pw_name,
pw_status (sp->sp_pwdp),
date_to_str (sp->sp_lstchg * SCALE),
(sp->sp_min * SCALE) / DAY,
(sp->sp_max * SCALE) / DAY,
(sp->sp_warn * SCALE) / DAY,
(sp->sp_inact * SCALE) / DAY);
} else {
printf ("%s %s\n", pw->pw_name, pw_status (pw->pw_passwd));
(void) printf ("%s %s\n",
pw->pw_name, pw_status (pw->pw_passwd));
}
}
static void fail_exit (int status)
static /*@noreturn@*/void fail_exit (int status)
{
if (pw_locked) {
if (pw_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
(void) fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
/* continue */
}
@@ -491,7 +485,7 @@ static void fail_exit (int status)
if (spw_locked) {
if (spw_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
(void) fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
/* continue */
}
@@ -500,9 +494,9 @@ static void fail_exit (int status)
exit (status);
}
static void oom (void)
static /*@noreturn@*/void oom (void)
{
fprintf (stderr, _("%s: out of memory\n"), Prog);
(void) fprintf (stderr, _("%s: out of memory\n"), Prog);
fail_exit (E_FAILURE);
}
@@ -510,7 +504,7 @@ static char *update_crypt_pw (char *cp)
{
#ifndef USE_PAM
if (do_update_pwd) {
cp = insert_crypt_passwd (cp, crypt_passwd);
cp = xstrdup (crypt_passwd);
}
#endif /* !USE_PAM */
@@ -520,10 +514,10 @@ static char *update_crypt_pw (char *cp)
if (uflg && *cp == '!') {
if (cp[1] == '\0') {
fprintf (stderr,
_("%s: unlocking the password would result in a passwordless account.\n"
"You should set a password with usermod -p to unlock the password of this account.\n"),
Prog);
(void) fprintf (stderr,
_("%s: unlocking the password would result in a passwordless account.\n"
"You should set a password with usermod -p to unlock the password of this account.\n"),
Prog);
fail_exit (E_FAILURE);
} else {
cp++;
@@ -547,24 +541,24 @@ static void update_noshadow (void)
struct passwd *npw;
if (pw_lock () == 0) {
fprintf (stderr,
_("%s: cannot lock %s; try again later.\n"),
Prog, pw_dbname ());
(void) fprintf (stderr,
_("%s: cannot lock %s; try again later.\n"),
Prog, pw_dbname ());
exit (E_PWDBUSY);
}
pw_locked = true;
if (pw_open (O_RDWR) == 0) {
fprintf (stderr,
_("%s: cannot open %s\n"),
Prog, pw_dbname ());
(void) fprintf (stderr,
_("%s: cannot open %s\n"),
Prog, pw_dbname ());
SYSLOG ((LOG_WARN, "cannot open %s", pw_dbname ()));
fail_exit (E_MISSING);
}
pw = pw_locate (name);
if (NULL == pw) {
fprintf (stderr,
_("%s: user '%s' does not exist in %s\n"),
Prog, name, pw_dbname ());
(void) fprintf (stderr,
_("%s: user '%s' does not exist in %s\n"),
Prog, name, pw_dbname ());
fail_exit (E_NOPERM);
}
npw = __pw_dup (pw);
@@ -573,20 +567,22 @@ static void update_noshadow (void)
}
npw->pw_passwd = update_crypt_pw (npw->pw_passwd);
if (pw_update (npw) == 0) {
fprintf (stderr,
_("%s: failed to prepare the new %s entry '%s'\n"),
Prog, pw_dbname (), npw->pw_name);
(void) fprintf (stderr,
_("%s: failed to prepare the new %s entry '%s'\n"),
Prog, pw_dbname (), npw->pw_name);
fail_exit (E_FAILURE);
}
if (pw_close () == 0) {
fprintf (stderr,
_("%s: failure while writing changes to %s\n"),
Prog, pw_dbname ());
(void) fprintf (stderr,
_("%s: failure while writing changes to %s\n"),
Prog, pw_dbname ());
SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ()));
fail_exit (E_FAILURE);
}
if (pw_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ());
(void) fprintf (stderr,
_("%s: failed to unlock %s\n"),
Prog, pw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ()));
/* continue */
}
@@ -599,14 +595,16 @@ static void update_shadow (void)
struct spwd *nsp;
if (spw_lock () == 0) {
fprintf (stderr,
_("%s: cannot lock %s; try again later.\n"),
Prog, spw_dbname ());
(void) fprintf (stderr,
_("%s: cannot lock %s; try again later.\n"),
Prog, spw_dbname ());
exit (E_PWDBUSY);
}
spw_locked = true;
if (spw_open (O_RDWR) == 0) {
fprintf (stderr, _("%s: cannot open %s\n"), Prog, spw_dbname ());
(void) fprintf (stderr,
_("%s: cannot open %s\n"),
Prog, spw_dbname ());
SYSLOG ((LOG_WARN, "cannot open %s", spw_dbname ()));
fail_exit (E_FAILURE);
}
@@ -616,7 +614,9 @@ static void update_shadow (void)
(void) spw_close ();
update_noshadow ();
if (spw_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
(void) fprintf (stderr,
_("%s: failed to unlock %s\n"),
Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
/* continue */
}
@@ -661,20 +661,22 @@ static void update_shadow (void)
}
if (spw_update (nsp) == 0) {
fprintf (stderr,
_("%s: failed to prepare the new %s entry '%s'\n"),
Prog, spw_dbname (), nsp->sp_namp);
(void) fprintf (stderr,
_("%s: failed to prepare the new %s entry '%s'\n"),
Prog, spw_dbname (), nsp->sp_namp);
fail_exit (E_FAILURE);
}
if (spw_close () == 0) {
fprintf (stderr,
_("%s: failure while writing changes to %s\n"),
Prog, spw_dbname ());
(void) fprintf (stderr,
_("%s: failure while writing changes to %s\n"),
Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_dbname ()));
fail_exit (E_FAILURE);
}
if (spw_unlock () == 0) {
fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ());
(void) fprintf (stderr,
_("%s: failed to unlock %s\n"),
Prog, spw_dbname ());
SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ()));
/* continue */
}
@@ -880,9 +882,9 @@ int main (int argc, char **argv)
case 'w':
if ( (getlong (optarg, &warn) == 0)
|| (warn < -1)) {
fprintf (stderr,
_("%s: invalid numeric argument '%s'\n"),
Prog, optarg);
(void) fprintf (stderr,
_("%s: invalid numeric argument '%s'\n"),
Prog, optarg);
usage (E_BAD_ARG);
}
wflg = true;
@@ -891,9 +893,9 @@ int main (int argc, char **argv)
case 'x':
if ( (getlong (optarg, &age_max) == 0)
|| (age_max < -1)) {
fprintf (stderr,
_("%s: invalid numeric argument '%s'\n"),
Prog, optarg);
(void) fprintf (stderr,
_("%s: invalid numeric argument '%s'\n"),
Prog, optarg);
usage (E_BAD_ARG);
}
xflg = true;
@@ -901,7 +903,7 @@ int main (int argc, char **argv)
break;
case 'h':
usage (E_SUCCESS);
break;
/*@notreached@*/break;
default:
usage (E_BAD_ARG);
}
@@ -915,8 +917,9 @@ int main (int argc, char **argv)
*/
pw = get_my_pwent ();
if (NULL == pw) {
fprintf (stderr,
_("%s: Cannot determine your user name.\n"), Prog);
(void) fprintf (stderr,
_("%s: Cannot determine your user name.\n"),
Prog);
SYSLOG ((LOG_WARN, "Cannot determine the user name of the caller (UID %lu)",
(unsigned long) getuid ()));
exit (E_NOPERM);
@@ -944,7 +947,9 @@ int main (int argc, char **argv)
usage (E_USAGE);
}
if (!amroot) {
fprintf (stderr, _("%s: Permission denied.\n"), Prog);
(void) fprintf (stderr,
_("%s: Permission denied.\n"),
Prog);
exit (E_NOPERM);
}
setpwent ();
@@ -984,13 +989,15 @@ int main (int argc, char **argv)
}
if (anyflag && !amroot) {
fprintf (stderr, _("%s: Permission denied.\n"), Prog);
(void) fprintf (stderr, _("%s: Permission denied.\n"), Prog);
exit (E_NOPERM);
}
pw = xgetpwnam (name);
if (NULL == pw) {
fprintf (stderr, _("%s: user '%s' does not exist\n"), Prog, name);
(void) fprintf (stderr,
_("%s: user '%s' does not exist\n"),
Prog, name);
exit (E_NOPERM);
}
#ifdef WITH_SELINUX
@@ -1001,14 +1008,14 @@ int main (int argc, char **argv)
security_context_t user_context = NULL;
const char *user = "Unknown user context";
if (getprevcon (&user_context) == 0) {
user = user_context;
user = user_context; /* FIXME: use context_user_get? */
}
SYSLOG ((LOG_ALERT,
"%s is not authorized to change the password of %s",
user, name));
fprintf(stderr,
_("%s: %s is not authorized to change the password of %s\n"),
Prog, user, name);
(void) fprintf(stderr,
_("%s: %s is not authorized to change the password of %s\n"),
Prog, user, name);
if (NULL != user_context) {
freecon (user_context);
}
@@ -1021,12 +1028,12 @@ int main (int argc, char **argv)
* check if I'm root.
*/
if (!amroot && (pw->pw_uid != getuid ())) {
fprintf (stderr,
_("%s: You may not view or modify password information for %s.\n"),
Prog, name);
(void) fprintf (stderr,
_("%s: You may not view or modify password information for %s.\n"),
Prog, name);
SYSLOG ((LOG_WARN,
"%s: can't view or modify password information for %s",
Prog, name));
"%s: can't view or modify password information for %s",
Prog, name));
closelog ();
exit (E_NOPERM);
}
@@ -1062,13 +1069,13 @@ int main (int argc, char **argv)
* Let the user know whose password is being changed.
*/
if (!qflg) {
printf (_("Changing password for %s\n"), name);
(void) printf (_("Changing password for %s\n"), name);
}
if (new_password (pw)) {
fprintf (stderr,
_("The password for %s is unchanged.\n"),
name);
if (new_password (pw) != 0) {
(void) fprintf (stderr,
_("The password for %s is unchanged.\n"),
name);
closelog ();
exit (E_NOPERM);
}
@@ -1094,7 +1101,7 @@ int main (int argc, char **argv)
}
#endif /* USE_PAM */
if (setuid (0) != 0) {
fputs (_("Cannot change ID to root.\n"), stderr);
(void) fputs (_("Cannot change ID to root.\n"), stderr);
SYSLOG ((LOG_ERR, "can't setuid(0)"));
closelog ();
exit (E_NOPERM);
@@ -1113,10 +1120,10 @@ int main (int argc, char **argv)
if (!qflg) {
if (!anyflag) {
#ifndef USE_PAM
printf (_("%s: password changed.\n"), Prog);
(void) printf (_("%s: password changed.\n"), Prog);
#endif /* USE_PAM */
} else {
printf (_("%s: password expiry information changed.\n"), Prog);
(void) printf (_("%s: password expiry information changed.\n"), Prog);
}
}

View File

@@ -112,7 +112,7 @@ static void execve_shell (const char *shellstr,
static RETSIGTYPE kill_child (int unused(s));
#else /* !USE_PAM */
static RETSIGTYPE die (int);
static int iswheel (const char *);
static bool iswheel (const char *);
#endif /* !USE_PAM */
#ifndef USE_PAM
@@ -138,14 +138,14 @@ static RETSIGTYPE die (int killed)
}
}
static int iswheel (const char *username)
static bool iswheel (const char *username)
{
struct group *grp;
grp = getgrnam ("wheel"); /* !USE_PAM, no need for xgetgrnam */
if ( (NULL ==grp)
|| (NULL == grp->gr_mem)) {
return 0;
return false;
}
return is_on_list (grp->gr_mem, username);
}

View File

@@ -126,7 +126,7 @@ static RETSIGTYPE catch_signals (unused int sig)
}
}
if (access (PASSWD_FILE, F_OK) == -1) { /* must be a password file! */
puts (_("No password file"));
(void) puts (_("No password file"));
#ifdef USE_SYSLOG
SYSLOG (LOG_WARN, "No password file\n");
closelog ();
@@ -152,7 +152,7 @@ static RETSIGTYPE catch_signals (unused int sig)
if (getppid() == 1) {
setsid();
if (ioctl(0, TIOCSCTTY, 1) != 0) {
fputs (_("TIOCSCTTY failed"), stderr);
(void) fputs (_("TIOCSCTTY failed"), stderr);
}
}
while (NULL != *envp) { /* add inherited environment, */
@@ -184,7 +184,7 @@ static RETSIGTYPE catch_signals (unused int sig)
/*
* Fail secure
*/
puts (_("No password entry for 'root'"));
(void) puts (_("No password entry for 'root'"));
#ifdef USE_SYSLOG
SYSLOG (LOG_WARN, "No password entry for 'root'\n");
closelog ();
@@ -198,10 +198,10 @@ static RETSIGTYPE catch_signals (unused int sig)
*/
/* get a password for root */
cp = getpass (_
("\n"
"Type control-d to proceed with normal startup,\n"
"(or give root password for system maintenance):"));
cp = getpass (_(
"\n"
"Type control-d to proceed with normal startup,\n"
"(or give root password for system maintenance):"));
/*
* XXX - can't enter single user mode if root password is
* empty. I think this doesn't happen very often :-). But
@@ -213,7 +213,7 @@ static RETSIGTYPE catch_signals (unused int sig)
SYSLOG (LOG_INFO, "Normal startup\n");
closelog ();
#endif
puts ("");
(void) puts ("");
#ifdef TELINIT
execl (PATH_TELINIT, "telinit", RUNLEVEL, (char *) 0);
#endif
@@ -230,14 +230,14 @@ static RETSIGTYPE catch_signals (unused int sig)
SYSLOG (LOG_WARN, "Incorrect root password\n");
#endif
sleep (2);
puts (_("Login incorrect"));
(void) puts (_("Login incorrect"));
}
strzero (pass);
(void) alarm (0);
(void) signal (SIGALRM, SIG_DFL);
environ = newenvp; /* make new environment active */
puts (_("Entering System Maintenance Mode"));
(void) puts (_("Entering System Maintenance Mode"));
#ifdef USE_SYSLOG
SYSLOG (LOG_INFO, "System Maintenance Mode\n");
#endif

View File

@@ -333,7 +333,7 @@ vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void))
#ifdef WITH_SELINUX
/* unset the fscreatecon */
if (is_selinux_enabled ()) {
if (setfscreatecon (NULL)) {
if (setfscreatecon (NULL) != 0) {
vipwexit (_("setfscreatecon () failed"), errno, 1);
}
}