aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-05-02 13:21:24 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-05-02 13:21:24 +0000
commit32dcc53b7162406148203b8222c3f5c5056f70f2 (patch)
treedcae696c5a80b3f5b51e4926d2e985a2dfcdb21c /util-linux
parent6da9b00f4fb54b3deba1c2636d69950fdbcc0d67 (diff)
downloadbusybox-32dcc53b7162406148203b8222c3f5c5056f70f2.tar.gz
mdev: fix a bug where we were eating argv[0] of helper
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/mdev.c62
1 files changed, 32 insertions, 30 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 9d37b6c90..5e1cd36bb 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -156,43 +156,45 @@ static void make_device(char *path, int delete)
mode = strtoul(val, NULL, 8);
/* 4th field (opt): >alias */
- if (ENABLE_FEATURE_MDEV_RENAME) {
- if (!next)
- break;
+#if ENABLE_FEATURE_MDEV_RENAME
+ if (!next)
+ break;
+ if (*next == '>') {
+#if ENABLE_FEATURE_MDEV_RENAME_REGEXP
+ char *s, *p;
+ unsigned i, n;
+
val = next;
next = next_field(val);
- if (*val == '>') {
-#if ENABLE_FEATURE_MDEV_RENAME_REGEXP
- /* substitute %1..9 with off[1..9], if any */
- char *s, *p;
- unsigned i, n;
-
- n = 0;
- s = val;
- while (*s && *s++ == '%')
- n++;
-
- p = alias = xzalloc(strlen(val) + n * strlen(device_name));
- s = val + 1;
- while (*s) {
- *p = *s;
- if ('%' == *s) {
- i = (s[1] - '0');
- if (i <= 9 && off[i].rm_so >= 0) {
- n = off[i].rm_eo - off[i].rm_so;
- strncpy(p, device_name + off[i].rm_so, n);
- p += n - 1;
- s++;
- }
+ /* substitute %1..9 with off[1..9], if any */
+ n = 0;
+ s = val;
+ while (*s && *s++ == '%')
+ n++;
+
+ p = alias = xzalloc(strlen(val) + n * strlen(device_name));
+ s = val + 1;
+ while (*s) {
+ *p = *s;
+ if ('%' == *s) {
+ i = (s[1] - '0');
+ if (i <= 9 && off[i].rm_so >= 0) {
+ n = off[i].rm_eo - off[i].rm_so;
+ strncpy(p, device_name + off[i].rm_so, n);
+ p += n - 1;
+ s++;
}
- p++;
- s++;
}
+ p++;
+ s++;
+ }
#else
- alias = xstrdup(val + 1);
+ val = next;
+ next = next_field(val);
+ alias = xstrdup(val + 1);
#endif
- }
}
+#endif /* ENABLE_FEATURE_MDEV_RENAME */
/* The rest (opt): command to run */
if (!next)