From e63639700c6908415a8b4c8be80c79dc9d282845 Mon Sep 17 00:00:00 2001 From: semarie Date: Thu, 2 Sep 2021 11:26:54 +0000 Subject: [PATCH] timeout(1): execvp(2) does not return except on error there is no need to check if the return value is -1. just unconditionally call err(3). ok deraadt@ schwarze@ --- usr.bin/timeout/timeout.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/usr.bin/timeout/timeout.c b/usr.bin/timeout/timeout.c index 616ff3ae88e..cbceb70a3df 100644 --- a/usr.bin/timeout/timeout.c +++ b/usr.bin/timeout/timeout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: timeout.c,v 1.16 2021/09/02 09:35:17 deraadt Exp $ */ +/* $OpenBSD: timeout.c,v 1.17 2021/09/02 11:26:54 semarie Exp $ */ /* * Copyright (c) 2021 Job Snijders @@ -164,7 +164,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; @@ -250,9 +250,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"); } /* parent continues here */ -- 2.20.1