svn commit: trunk/busybox/util-linux

vda at busybox.net vda at busybox.net
Thu May 22 17:49:58 UTC 2008


Author: vda
Date: 2008-05-22 10:49:58 -0700 (Thu, 22 May 2008)
New Revision: 22052

Log:
mdev: add support for "only rename" option in mdev.conf



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


Changeset:
Modified: trunk/busybox/util-linux/mdev.c
===================================================================
--- trunk/busybox/util-linux/mdev.c	2008-05-22 17:41:01 UTC (rev 22051)
+++ trunk/busybox/util-linux/mdev.c	2008-05-22 17:49:58 UTC (rev 22052)
@@ -46,6 +46,7 @@
 	char *dev_maj_min = path + strlen(path);
 	char *command = NULL;
 	char *alias = NULL;
+	int aliaslink;
 
 	/* Force the configuration file settings exactly. */
 	umask(0);
@@ -168,11 +169,12 @@
 #if ENABLE_FEATURE_MDEV_RENAME
 			if (!next)
 				break;
-			if (*next == '>') {
+			if (*next == '>' || *next == '=') {
 #if ENABLE_FEATURE_MDEV_RENAME_REGEXP
 				char *s, *p;
 				unsigned i, n;
 
+				aliaslink = (*next == '>');
 				val = next;
 				next = next_field(val);
 				/* substitute %1..9 with off[1..9], if any */
@@ -198,6 +200,7 @@
 					s++;
 				}
 #else
+				aliaslink = (*next == '>');
 				val = next;
 				next = next_field(val);
 				alias = xstrdup(val + 1);
@@ -269,9 +272,8 @@
 				}
 
 				/* recreate device_name as a symlink to moved device node */
-				if (rename(device_name, alias) == 0) {
+				if (rename(device_name, alias) == 0 && aliaslink) 
 					symlink(alias, device_name);
-				}
 
 				free(alias);
 			}




More information about the busybox-cvs mailing list