From: Josef Möllers Date: Mon, 20 Feb 2017 13:32:37 +0000 (+0100) Subject: Add error handling in case exec fails X-Git-Tag: 4.5~9^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5ac4918bdd70474c3f01adbe12f92fbf69659114;p=thirdparty%2Fshadow.git Add error handling in case exec fails We should print error message if exec fails, for some reason. --- diff --git a/src/useradd.c b/src/useradd.c index d973ca329..1a565cf08 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -1817,7 +1817,9 @@ static void tallylog_reset (char *user_name) pname++; /* Skip the '/' */ execl(pam_tally2, pname, "--user", user_name, "--reset", "--quiet", NULL); /* 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; default: /* parent */ if (waitpid(childpid, &status, 0) == -1 || !WIFEXITED(status) || WEXITSTATUS(status) != 0)