From 5ac4918bdd70474c3f01adbe12f92fbf69659114 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Josef=20M=C3=B6llers?= Date: Mon, 20 Feb 2017 14:32:37 +0100 Subject: [PATCH] Add error handling in case exec fails We should print error message if exec fails, for some reason. --- src/useradd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/useradd.c b/src/useradd.c index d973ca32..1a565cf0 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) -- 2.40.0