]> granicus.if.org Git - shadow/commitdiff
Add error handling in case exec fails
authorJosef Möllers <josef.moellers@suse.com>
Mon, 20 Feb 2017 13:32:37 +0000 (14:32 +0100)
committerAdam Majer <amajer@suse.de>
Mon, 20 Feb 2017 13:32:37 +0000 (14:32 +0100)
We should print error message if exec fails, for some reason.

src/useradd.c

index d973ca329141798cc9408753d9d19ffffb548382..1a565cf088acb524e76bf937a12b5abf555d3e54 100644 (file)
@@ -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)