Merge pull request #67 from AdamMajer/upstream
Print error on exec failure + cosmetic changes
This commit is contained in:
commit
24130c882d
@ -1794,7 +1794,7 @@ static void lastlog_reset (uid_t uid)
|
|||||||
|
|
||||||
static void tallylog_reset (char *user_name)
|
static void tallylog_reset (char *user_name)
|
||||||
{
|
{
|
||||||
static const char pam_tally2[] = "/sbin/pam_tally2";
|
const char pam_tally2[] = "/sbin/pam_tally2";
|
||||||
const char *pname;
|
const char *pname;
|
||||||
pid_t childpid;
|
pid_t childpid;
|
||||||
int failed;
|
int failed;
|
||||||
@ -1817,7 +1817,9 @@ static void tallylog_reset (char *user_name)
|
|||||||
pname++; /* Skip the '/' */
|
pname++; /* Skip the '/' */
|
||||||
execl(pam_tally2, pname, "--user", user_name, "--reset", "--quiet", NULL);
|
execl(pam_tally2, pname, "--user", user_name, "--reset", "--quiet", NULL);
|
||||||
/* If we come here, something has gone terribly wrong */
|
/* If we come here, something has gone terribly wrong */
|
||||||
failed = 1;
|
perror(pam_tally2);
|
||||||
|
exit(42); /* don't continue, we now have 2 processes running! */
|
||||||
|
/* NOTREACHED */
|
||||||
break;
|
break;
|
||||||
default: /* parent */
|
default: /* parent */
|
||||||
if (waitpid(childpid, &status, 0) == -1 || !WIFEXITED(status) || WEXITSTATUS(status) != 0)
|
if (waitpid(childpid, &status, 0) == -1 || !WIFEXITED(status) || WEXITSTATUS(status) != 0)
|
||||||
@ -2285,7 +2287,7 @@ int main (int argc, char **argv)
|
|||||||
* a valid existing user name,
|
* a valid existing user name,
|
||||||
* so we canot call it before close_files()
|
* so we canot call it before close_files()
|
||||||
*/
|
*/
|
||||||
if ((!lflg) && (getpwuid (user_id) != NULL)) {
|
if (!lflg && getpwuid (user_id) != NULL) {
|
||||||
tallylog_reset (user_name);
|
tallylog_reset (user_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user