changeset 197:571623c6765d

Changeset 186 assumed that toys.exitval defaults to 0. Actually change the default and have [p]error_exit() always return nonzero anyway.
author Rob Landley <rob@landley.net>
date Sun, 09 Dec 2007 15:35:42 -0600
parents e83f92dc44a0
children 3227c5316260
files lib/lib.c main.c
diffstat 2 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lib/lib.c	Sun Dec 09 15:32:07 2007 -0600
+++ b/lib/lib.c	Sun Dec 09 15:35:42 2007 -0600
@@ -59,7 +59,7 @@
 	verror_msg(msg, 0, va);
 	va_end(va);
 
-	exit(toys.exitval);
+	exit(!toys.exitval ? 1 : toys.exitval);
 }
 
 
@@ -72,7 +72,7 @@
 	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 @@
 	free(cwd);
 
 	return rlist;
-
 }
 
 // Convert unsigned int to ascii, writing into supplied buffer.  A truncated
--- a/main.c	Sun Dec 09 15:32:07 2007 -0600
+++ b/main.c	Sun Dec 09 15:35:42 2007 -0600
@@ -68,7 +68,6 @@
 
 	toys.which = which;
 	toys.argv = argv;
-	toys.exitval = 1;
 	if (NEED_OPTIONS && which->options) get_optflags();
 	else toys.optargs = argv+1;
 }