aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/lib.c5
-rw-r--r--main.c1
2 files changed, 2 insertions, 4 deletions
diff --git a/lib/lib.c b/lib/lib.c
index 2fd7fb8e..389adcdc 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -59,7 +59,7 @@ void error_exit(char *msg, ...)
verror_msg(msg, 0, va);
va_end(va);
- exit(toys.exitval);
+ exit(!toys.exitval ? 1 : toys.exitval);
}
@@ -72,7 +72,7 @@ void perror_exit(char *msg, ...)
verror_msg(msg, errno, va);
va_end(va);
- exit(toys.exitval);
+ exit(!toys.exitval ? 1 : toys.exitval);
}
// Die unless we can allocate memory.
@@ -350,7 +350,6 @@ struct string_list *find_in_path(char *path, char *filename)
free(cwd);
return rlist;
-
}
// Convert unsigned int to ascii, writing into supplied buffer. A truncated
diff --git a/main.c b/main.c
index 4b58d8c2..1adaead3 100644
--- a/main.c
+++ b/main.c
@@ -68,7 +68,6 @@ void toy_init(struct toy_list *which, char *argv[])
toys.which = which;
toys.argv = argv;
- toys.exitval = 1;
if (NEED_OPTIONS && which->options) get_optflags();
else toys.optargs = argv+1;
}