Hi,

If execvp(2) returns, it is always an error: there is no need to check
if the return value is -1. Just unconditionally call err(3).

Comments or OK ?
-- 
Sebastien Marie


 timeout: execvp(2) should not return except on error
 
diff 7821223d9093e8d64d2bab7db6b91e28360fdab3 
e4e5edd4879c3b7829d67cfb2b2fa1f7064c7b60
blob - 768df18bc0d2acc1b2ef46ea2693e4ef3c1d9d3a
blob + e45382c8f28e58754a579a6491580ebaab1d9a26
--- usr.bin/timeout/timeout.c
+++ usr.bin/timeout/timeout.c
@@ -165,7 +165,7 @@ main(int argc, char **argv)
        int             ch;
        unsigned long   i;
        int             foreground = 0, preserve = 0;
-       int             error, pstat, status;
+       int             pstat, status;
        int             killsig = SIGTERM;
        pid_t           pgid = 0, pid, cpid = 0;
        double          first_kill;
@@ -251,9 +251,8 @@ main(int argc, char **argv)
                signal(SIGTTIN, SIG_DFL);
                signal(SIGTTOU, SIG_DFL);
 
-               error = execvp(argv[0], argv);
-               if (error == -1)
-                       err(1, "execvp");
+               execvp(argv[0], argv);
+               err(1, "execvp");
        }
 
        if (pledge("stdio", NULL) == -1)

Reply via email to