svn commit: trunk/busybox/debianutils

vda at busybox.net vda at busybox.net
Sun Apr 29 23:38:13 UTC 2007


Author: vda
Date: 2007-04-29 16:38:12 -0700 (Sun, 29 Apr 2007)
New Revision: 18531

Log:
run_parts: do not check path portion of a name for "bad chars".
Needed for ifupdown. Patch by "Gabriel L. Somlo" <somlo at cmu.edu>


Modified:
   trunk/busybox/debianutils/run_parts.c


Changeset:
Modified: trunk/busybox/debianutils/run_parts.c
===================================================================
--- trunk/busybox/debianutils/run_parts.c	2007-04-28 22:39:02 UTC (rev 18530)
+++ trunk/busybox/debianutils/run_parts.c	2007-04-29 23:38:12 UTC (rev 18531)
@@ -60,14 +60,17 @@
  */
 static bool invalid_name(const char *c)
 {
-	while (*c) {
-		if (!isalnum(*c) && (*c != '_') && (*c != '-' && (*c != '/'))) {
-			return 1;
-		}
-		++c;
-	}
-	return 0;
+	const char *base_name = strrchr(c, '/');
+
+	if (base_name)
+		c = base_name + 1;
+
+	while (*c && (isalnum(*c) || *c == '_' || *c == '-'))
+		c++;
+
+	return *c; /* TRUE (!0) if terminating NUL is not reached */
 }
+
 #define RUN_PARTS_OPT_a (1<<0)
 #define RUN_PARTS_OPT_u (1<<1)
 #define RUN_PARTS_OPT_t (1<<2)
@@ -81,6 +84,7 @@
 #else
 #define list_mode (0)
 #endif
+
 static int act(const char *file, struct stat *statbuf, void *args, int depth)
 {
 	int ret;




More information about the busybox-cvs mailing list