diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2012-01-29 05:37:39 +0100 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2012-01-29 05:48:45 +0100 |
commit | e7f32890335886cfa0f2f835413aed5af8ac2b53 (patch) | |
tree | 73c60658fbcfc52c5215fc5f8760d266b7249386 /src | |
parent | a3642381eba4697b567cf4f21145532866c2e369 (diff) |
do not stop rule processing when device node is no longer around
Device nodes might have been deleted again by the kernel before an
'add' or 'change' event is even started. We need to run all rules,
regardless of the state in /dev.
Diffstat (limited to 'src')
-rw-r--r-- | src/udev-event.c | 4 | ||||
-rw-r--r-- | src/udev-node.c | 14 | ||||
-rw-r--r-- | src/udev.h | 4 |
3 files changed, 8 insertions, 14 deletions
diff --git a/src/udev-event.c b/src/udev-event.c index 7ecaf85536..45dd77ba2e 100644 --- a/src/udev-event.c +++ b/src/udev-event.c @@ -894,7 +894,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, udev_rules_apply_to_event(rules, event, sigmask); if (major(udev_device_get_devnum(dev)) != 0) - err = udev_node_remove(dev); + udev_node_remove(dev); } else { event->dev_db = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(dev)); if (event->dev_db != NULL) { @@ -952,7 +952,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, } } - err = udev_node_add(dev, event->mode, event->uid, event->gid); + udev_node_add(dev, event->mode, event->uid, event->gid); } /* preserve old, or get new initialization timestamp */ diff --git a/src/udev-node.c b/src/udev-node.c index 8d7db7101b..7a01a479ee 100644 --- a/src/udev-node.c +++ b/src/udev-node.c @@ -327,7 +327,7 @@ out: return err; } -int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) +void udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) { struct udev *udev = udev_device_get_udev(dev); char filename[UTIL_PATH_SIZE]; @@ -337,9 +337,8 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) info(udev, "handling device node '%s', devnum=%s, mode=%#o, uid=%d, gid=%d\n", udev_device_get_devnode(dev), udev_device_get_id_filename(dev), mode, uid, gid); - err = node_fixup(dev, mode, uid, gid); - if (err < 0) - goto exit; + if (node_fixup(dev, mode, uid, gid) < 0) + return; /* always add /dev/{block,char}/$major:$minor */ snprintf(filename, sizeof(filename), "%s/%s/%u:%u", @@ -356,11 +355,9 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) else link_update(dev, udev_list_entry_get_name(list_entry), 1); } -exit: - return err; } -int udev_node_remove(struct udev_device *dev) +void udev_node_remove(struct udev_device *dev) { struct udev *udev = udev_device_get_udev(dev); struct udev_list_entry *list_entry; @@ -368,7 +365,6 @@ int udev_node_remove(struct udev_device *dev) struct stat stats; struct udev_device *dev_check; char filename[UTIL_PATH_SIZE]; - int err = 0; /* remove/update symlinks, remove symlinks from name index */ udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) @@ -380,6 +376,4 @@ int udev_node_remove(struct udev_device *dev) strcmp(udev_device_get_subsystem(dev), "block") == 0 ? "block" : "char", major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); unlink(filename); -out: - return err; } diff --git a/src/udev.h b/src/udev.h index 9ed6804fe7..bc051c9b65 100644 --- a/src/udev.h +++ b/src/udev.h @@ -89,8 +89,8 @@ void udev_watch_end(struct udev *udev, struct udev_device *dev); struct udev_device *udev_watch_lookup(struct udev *udev, int wd); /* udev-node.c */ -int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid); -int udev_node_remove(struct udev_device *dev); +void udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid); +void udev_node_remove(struct udev_device *dev); void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old); /* udev-ctrl.c */ |