svn commit: trunk/busybox/util-linux

vapier at busybox.net vapier at busybox.net
Wed Feb 20 18:31:37 UTC 2008


Author: vapier
Date: 2008-02-20 10:31:36 -0800 (Wed, 20 Feb 2008)
New Revision: 21076

Log:
[#1334] exec script for devices even if they dont have device nodes

Modified:
   trunk/busybox/util-linux/mdev.c


Changeset:
Modified: trunk/busybox/util-linux/mdev.c
===================================================================
--- trunk/busybox/util-linux/mdev.c	2008-02-20 17:56:59 UTC (rev 21075)
+++ trunk/busybox/util-linux/mdev.c	2008-02-20 18:31:36 UTC (rev 21076)
@@ -45,8 +45,13 @@
 		strcat(path, "/dev");
 		len = open_read_close(path, temp + 1, 64);
 		*temp++ = 0;
-		if (len < 1)
-			return;
+		if (len < 1) {
+			if (ENABLE_FEATURE_MDEV_EXEC)
+				/* no "dev" file, so just try to run script */
+				*temp = 0;
+			else
+				return;
+		}
 	}
 
 	/* Determine device name, type, major and minor */
@@ -181,8 +186,12 @@
 	}
 
 	if (!delete) {
-		if (sscanf(temp, "%d:%d", &major, &minor) != 2)
-			return;
+		if (sscanf(temp, "%d:%d", &major, &minor) != 2) {
+			if (ENABLE_FEATURE_MDEV_EXEC)
+				goto skip_creation;
+			else
+				return;
+		}
 
 		if (ENABLE_FEATURE_MDEV_RENAME)
 			unlink(device_name);
@@ -217,6 +226,7 @@
 				free(dest);
 			}
 		}
+ skip_creation: /* nothing */ ;
 	}
 	if (ENABLE_FEATURE_MDEV_EXEC && command) {
 		/* setenv will leak memory, so use putenv */




More information about the busybox-cvs mailing list