diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2012-01-23 05:00:59 +0100 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2012-01-23 05:15:12 +0100 |
commit | 0ecfcbd4f758f9ff10926156eb8c7a7542650627 (patch) | |
tree | 18d7068a57cc06467b0bf89e0e0d0413e412a2e5 /src/udev-rules.c | |
parent | b0a00806770a7443d1710d58190a65b4f9f4f60e (diff) |
print warning when rules try to rename kernel device nodes
Diffstat (limited to 'src/udev-rules.c')
-rw-r--r-- | src/udev-rules.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/udev-rules.c b/src/udev-rules.c index 8efc498f75..a5b4b7306a 100644 --- a/src/udev-rules.c +++ b/src/udev-rules.c @@ -2546,6 +2546,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event } case TK_A_NAME: { const char *name = &rules->buf[cur->key.value_off]; + char name_str[UTIL_PATH_SIZE]; int count; @@ -2559,6 +2560,16 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (count > 0) info(event->udev, "%i character(s) replaced\n", count); } + if (major(udev_device_get_devnum(event->dev))) { + size_t devlen = strlen(udev_get_dev_path(event->udev))+1; + + if (strcmp(name_str, &udev_device_get_devnode(event->dev)[devlen]) != 0) { + err(event->udev, "NAME=\"%s\" ignored, kernel device nodes " + "can not be renamed; please fix it in %s:%u\n", name, + &rules->buf[rule->rule.filename_off], rule->rule.filename_line); + break; + } + } free(event->name); event->name = strdup(name_str); info(event->udev, "NAME '%s' %s:%u\n", |