[BusyBox] bug#1066: another smaller patch

Matt Kraai kraai at busybox.net
Mon Oct 23 17:51:35 UTC 2000


Howdy,

As pointed out by David Douhitt, my previous patch was broken for
multiple arguments.  How about the following, which is similar to the
original only with one less variable and using EXIT_* instead of
TRUE/FALSE?

Matt

Index: which.c
===================================================================
RCS file: /var/cvs/busybox/which.c,v
retrieving revision 1.10
diff -u -r1.10 which.c
--- which.c	2000/09/25 21:45:58	1.10
+++ which.c	2000/10/23 17:42:50
@@ -28,7 +28,7 @@
 {
 	char *path_list, *path_n;
 	struct stat filestat;
-	int i, count=1;
+	int i, count=1, status = EXIT_SUCCESS;
 
 	if (argc <= 1 || **(argv + 1) == '-')
 		usage(which_usage);
@@ -61,8 +61,10 @@
 			}
 			path_n += (strlen(path_n) + 1);
 		}
+		if (i == count)
+			status = EXIT_FAILURE;
 	}
-	return(TRUE);
+	return status;
 }
 
 /*






More information about the busybox mailing list