X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=udev_rules.c;h=3ec8477461e43fe61be68d2e4f2d24dedd9dc0bf;hb=25c208d659cf0f8bc887a1f7c62e9d2e0c546aec;hp=01fb2117b25d2499fa3dcabffdc398a2a8bb2906;hpb=1113044be205f9d78642744ffaa01329a77bee79;p=elogind.git diff --git a/udev_rules.c b/udev_rules.c index 01fb2117b..3ec847746 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -349,11 +349,6 @@ static int import_keys_into_env(struct udevice *udev, const char *buf, size_t bu cur += count+1; lineno++; - if (count >= sizeof(line)) { - err("line too long, conf line skipped %s, line %d", udev_config_filename, lineno); - continue; - } - /* eat the whitespace */ while ((count > 0) && isspace(bufline[0])) { bufline++; @@ -366,6 +361,11 @@ static int import_keys_into_env(struct udevice *udev, const char *buf, size_t bu if (bufline[0] == COMMENT_CHARACTER) continue; + if (count >= sizeof(line)) { + err("line too long, conf line skipped %s, line %d", udev_config_filename, lineno); + continue; + } + memcpy(line, bufline, count); line[count] = '\0'; @@ -994,7 +994,8 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) } } - if (rule->test.operation != KEY_OP_UNSET) { + if (rule->test.operation == KEY_OP_MATCH || + rule->test.operation == KEY_OP_NOMATCH) { char filename[PATH_SIZE]; char devpath[PATH_SIZE]; char *attr; @@ -1039,7 +1040,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) if (rule->wait_for_sysfs.operation != KEY_OP_UNSET) { int found; - found = (wait_for_sysfs(udev, key_val(rule, &rule->wait_for_sysfs), 3) == 0); + found = (wait_for_sysfs(udev, key_val(rule, &rule->wait_for_sysfs), 10) == 0); if (!found && (rule->wait_for_sysfs.operation != KEY_OP_NOMATCH)) goto nomatch; } @@ -1472,9 +1473,14 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) break; dbg("process rule"); - if (rule->name.operation != KEY_OP_UNSET || rule->symlink.operation != KEY_OP_UNSET || - rule->mode_operation != KEY_OP_UNSET || rule->owner.operation != KEY_OP_UNSET || - rule->group.operation != KEY_OP_UNSET) { + if (rule->name.operation == KEY_OP_ASSIGN || + rule->name.operation == KEY_OP_ASSIGN_FINAL || + rule->name.operation == KEY_OP_ADD || + rule->symlink.operation == KEY_OP_ASSIGN || + rule->symlink.operation == KEY_OP_ASSIGN_FINAL || + rule->symlink.operation == KEY_OP_ADD || + rule->mode_operation != KEY_OP_UNSET || + rule->owner.operation != KEY_OP_UNSET || rule->group.operation != KEY_OP_UNSET) { dbg("skip rule that names a device"); continue; } @@ -1485,6 +1491,10 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) udev->ignore_device = 1; return 0; } + if (rule->ignore_remove) { + udev->ignore_remove = 1; + dbg("remove event should be ignored"); + } if (!udev->run_final && rule->run.operation != KEY_OP_UNSET) { struct name_entry *entry;