summaryrefslogtreecommitdiff
path: root/usr.bin/timeout
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2021-09-01 20:03:44 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2021-09-01 20:03:44 +0000
commit161a1da61e3d104c9cd6b5d05b5e299ce9fb4ab3 (patch)
tree7fa91df3fc7643d4281b9606a622fed064d161f4 /usr.bin/timeout
parent0036e2a9e502928a1e21a3ef6d14ff3a2f8a4034 (diff)
small unused/initialization improvements
Diffstat (limited to 'usr.bin/timeout')
-rw-r--r--usr.bin/timeout/timeout.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/usr.bin/timeout/timeout.c b/usr.bin/timeout/timeout.c
index 15021466e65..56b7a2bbf33 100644
--- a/usr.bin/timeout/timeout.c
+++ b/usr.bin/timeout/timeout.c
@@ -99,14 +99,13 @@ parse_duration(const char *duration)
static int
parse_signal(const char *str)
{
- char *ep;
- int i;
- long sig;
+ long long sig;
const char *errstr;
if (strncasecmp(str, "SIG", 3) == 0) {
- str += 3;
+ int i;
+ str += 3;
for (i = 1; i < NSIG; i++) {
if (strcasecmp(str, sys_signame[i]) == 0)
return (i);
@@ -164,12 +163,12 @@ main(int argc, char **argv)
{
int ch;
unsigned long i;
- int foreground, preserve;
+ int foreground = 0, preserve = 0;
int error, pstat, status;
int killsig = SIGTERM;
- pid_t pgid, pid, cpid;
+ pid_t pgid = 0, pid, cpid = 0;
double first_kill;
- double second_kill;
+ double second_kill = 0;
bool timedout = false;
bool do_second_kill = false;
struct sigaction signals;
@@ -188,11 +187,6 @@ main(int argc, char **argv)
if (pledge("stdio proc exec", NULL) == -1)
err(1, "pledge");
- foreground = preserve = 0;
- second_kill = 0;
- cpid = -1;
- pgid = -1;
-
while ((ch = getopt_long(argc, argv, "+k:s:h", longopts, NULL)) != -1) {
switch (ch) {
case 'k':