* libmisc/setugid.c, src/login_nopam.c, src/suauth.c,
lib/getdef.c: Replace the %m format string by strerror(). This avoids errno to be reset between the system call error and the report function.
This commit is contained in:
@ -133,7 +133,8 @@ int login_access (const char *user, const char *from)
|
||||
}
|
||||
(void) fclose (fp);
|
||||
} else if (errno != ENOENT) {
|
||||
SYSLOG ((LOG_ERR, "cannot open %s: %m", TABLE));
|
||||
int err = errno;
|
||||
SYSLOG ((LOG_ERR, "cannot open %s: %s", TABLE, strerror (err)));
|
||||
}
|
||||
return (!match || (line[0] == '+'))?1:0;
|
||||
}
|
||||
|
@ -76,17 +76,19 @@ int check_su_auth (const char *actual_id, const char *wanted_id)
|
||||
char *action;
|
||||
|
||||
if (!(authfile_fd = fopen (SUAUTHFILE, "r"))) {
|
||||
int err = errno;
|
||||
/*
|
||||
* If the file doesn't exist - default to the standard su
|
||||
* behaviour (no access control). If open fails for some
|
||||
* other reason - maybe someone is trying to fool us with
|
||||
* file descriptors limit etc., so deny access. --marekm
|
||||
*/
|
||||
if (errno == ENOENT)
|
||||
if (ENOENT == err) {
|
||||
return NOACTION;
|
||||
}
|
||||
SYSLOG ((LOG_ERR,
|
||||
"could not open/read config file '%s': %m\n",
|
||||
SUAUTHFILE));
|
||||
"could not open/read config file '%s': %s\n",
|
||||
SUAUTHFILE, strerror (err)));
|
||||
return DENY;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user