diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-05-22 17:49:58 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-05-22 17:49:58 +0000 |
commit | 4801441e9a30015c6e11b300eae49c91b5c9af7a (patch) | |
tree | 0e1abd5fc8581abfccaea34cd49bc4cf67246d91 /util-linux/mdev.c | |
parent | e9b76e1f1e37f91ec9b30274594b7953f1afa6a2 (diff) | |
download | busybox-w32-4801441e9a30015c6e11b300eae49c91b5c9af7a.tar.gz busybox-w32-4801441e9a30015c6e11b300eae49c91b5c9af7a.tar.bz2 busybox-w32-4801441e9a30015c6e11b300eae49c91b5c9af7a.zip |
mdev: add support for "only rename" option in mdev.conf
Diffstat (limited to 'util-linux/mdev.c')
-rw-r--r-- | util-linux/mdev.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c index 14aa593f5..d5faf432e 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c | |||
@@ -46,6 +46,7 @@ static void make_device(char *path, int delete) | |||
46 | char *dev_maj_min = path + strlen(path); | 46 | char *dev_maj_min = path + strlen(path); |
47 | char *command = NULL; | 47 | char *command = NULL; |
48 | char *alias = NULL; | 48 | char *alias = NULL; |
49 | int aliaslink; | ||
49 | 50 | ||
50 | /* Force the configuration file settings exactly. */ | 51 | /* Force the configuration file settings exactly. */ |
51 | umask(0); | 52 | umask(0); |
@@ -168,11 +169,12 @@ static void make_device(char *path, int delete) | |||
168 | #if ENABLE_FEATURE_MDEV_RENAME | 169 | #if ENABLE_FEATURE_MDEV_RENAME |
169 | if (!next) | 170 | if (!next) |
170 | break; | 171 | break; |
171 | if (*next == '>') { | 172 | if (*next == '>' || *next == '=') { |
172 | #if ENABLE_FEATURE_MDEV_RENAME_REGEXP | 173 | #if ENABLE_FEATURE_MDEV_RENAME_REGEXP |
173 | char *s, *p; | 174 | char *s, *p; |
174 | unsigned i, n; | 175 | unsigned i, n; |
175 | 176 | ||
177 | aliaslink = (*next == '>'); | ||
176 | val = next; | 178 | val = next; |
177 | next = next_field(val); | 179 | next = next_field(val); |
178 | /* substitute %1..9 with off[1..9], if any */ | 180 | /* substitute %1..9 with off[1..9], if any */ |
@@ -198,6 +200,7 @@ static void make_device(char *path, int delete) | |||
198 | s++; | 200 | s++; |
199 | } | 201 | } |
200 | #else | 202 | #else |
203 | aliaslink = (*next == '>'); | ||
201 | val = next; | 204 | val = next; |
202 | next = next_field(val); | 205 | next = next_field(val); |
203 | alias = xstrdup(val + 1); | 206 | alias = xstrdup(val + 1); |
@@ -269,9 +272,8 @@ static void make_device(char *path, int delete) | |||
269 | } | 272 | } |
270 | 273 | ||
271 | /* recreate device_name as a symlink to moved device node */ | 274 | /* recreate device_name as a symlink to moved device node */ |
272 | if (rename(device_name, alias) == 0) { | 275 | if (rename(device_name, alias) == 0 && aliaslink) |
273 | symlink(alias, device_name); | 276 | symlink(alias, device_name); |
274 | } | ||
275 | 277 | ||
276 | free(alias); | 278 | free(alias); |
277 | } | 279 | } |