[BusyBox-cvs] busybox/libbb run_parts.c,1.4,1.5

Glenn McGrath bug1 at busybox.net
Mon Jan 20 23:51:02 UTC 2003


Update of /var/cvs/busybox/libbb
In directory winder:/tmp/cvs-serv12093/libbb

Modified Files:
	run_parts.c 
Log Message:
New test mode that allows run_parts to fail silently if the directory 
is not found. Patch from Bastian Blank


Index: run_parts.c
===================================================================
RCS file: /var/cvs/busybox/libbb/run_parts.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- run_parts.c	20 Jan 2003 23:34:12 -0000	1.4
+++ run_parts.c	20 Jan 2003 23:50:58 -0000	1.5
@@ -43,8 +43,10 @@
 	return 1;
 }
 
-/* run_parts */
-/* Find the parts to run & call run_part() */
+/* test mode = 1 is the same as offical run_parts
+ * test_mode = 2 means to fail siliently on missing directories
+ */
+
 extern int run_parts(char **args, const unsigned char test_mode)
 {
 	struct dirent **namelist = 0;
@@ -64,6 +66,9 @@
 	entries = scandir(arg0, &namelist, valid_name, alphasort);
 
 	if (entries == -1) {
+		if (test_mode & 2) {
+			return(2);
+		}
 		perror_msg_and_die("failed to open directory %s", arg0);
 	}
 
@@ -75,8 +80,8 @@
 			perror_msg_and_die("failed to stat component %s", filename);
 		}
 		if (S_ISREG(st.st_mode) && !access(filename, X_OK)) {
-			if (test_mode) {
-				puts("%s", filename);
+			if (test_mode & 1) {
+				puts(filename);
 			} else {
 				/* exec_errno is common vfork variable */
 				volatile int exec_errno = 0;




More information about the busybox-cvs mailing list