summaryrefslogtreecommitdiff
path: root/util-linux/mdev.c
diff options
context:
space:
mode:
authorDenis Vlasenko2008-05-22 17:49:58 +0000
committerDenis Vlasenko2008-05-22 17:49:58 +0000
commit4801441e9a30015c6e11b300eae49c91b5c9af7a (patch)
tree0e1abd5fc8581abfccaea34cd49bc4cf67246d91 /util-linux/mdev.c
parente9b76e1f1e37f91ec9b30274594b7953f1afa6a2 (diff)
downloadbusybox-4801441e9a30015c6e11b300eae49c91b5c9af7a.zip
busybox-4801441e9a30015c6e11b300eae49c91b5c9af7a.tar.gz
mdev: add support for "only rename" option in mdev.conf
Diffstat (limited to 'util-linux/mdev.c')
-rw-r--r--util-linux/mdev.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 14aa593..d5faf43 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -46,6 +46,7 @@ static void make_device(char *path, int delete)
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 @@ static void make_device(char *path, int delete)
#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 @@ static void make_device(char *path, int delete)
s++;
}
#else
+ aliaslink = (*next == '>');
val = next;
next = next_field(val);
alias = xstrdup(val + 1);
@@ -269,9 +272,8 @@ static void make_device(char *path, int delete)
}
/* 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);
}