summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Clayton <chris2553@googlemail.com>2015-06-18 13:22:13 -0400
committerAnthony G. Basile <blueness@gentoo.org>2015-06-18 13:22:13 -0400
commit52a4d0c0d509e89571fdd7233b9b259c5fcafe52 (patch)
treea41f12732862698372368f86ca5314a33c67b0b0 /src
parent7061de26fa038719b70f6fdf971acf8ff807fd2f (diff)
udevd: fix REMOVE handling
The original upstream commit is at http://cgit.freedesktop.org/systemd/systemd/commit/?id=107f2e2526d476c6cc9b81a690391c111027d641 This was reworked by Chris Clayton for eudev. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src')
-rw-r--r--src/libudev/libudev-device.c3
-rw-r--r--src/libudev/libudev.h1
-rw-r--r--src/udev/udev-event.c7
3 files changed, 6 insertions, 5 deletions
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index 9e6a45efa6..ed9964ac44 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -37,7 +37,6 @@
#include "libudev-private.h"
static int udev_device_read_uevent_file(struct udev_device *udev_device);
-static int udev_device_read_db(struct udev_device *udev_device);
static int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode);
static struct udev_list_entry *udev_device_add_property_internal(struct udev_device *udev_device, const char *key, const char *value);
@@ -594,7 +593,7 @@ _public_ const char *udev_device_get_property_value(struct udev_device *udev_dev
return udev_list_entry_get_value(list_entry);
}
-static int udev_device_read_db(struct udev_device *udev_device)
+int udev_device_read_db(struct udev_device *udev_device)
{
char filename[UTIL_PATH_SIZE];
char line[UTIL_LINE_SIZE];
diff --git a/src/libudev/libudev.h b/src/libudev/libudev.h
index a94505c09e..8a2441a825 100644
--- a/src/libudev/libudev.h
+++ b/src/libudev/libudev.h
@@ -88,6 +88,7 @@ struct udev_device *udev_device_get_parent(struct udev_device *udev_device);
struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device,
const char *subsystem, const char *devtype);
/* retrieve device properties */
+int udev_device_read_db(struct udev_device *udev_device);
const char *udev_device_get_devpath(struct udev_device *udev_device);
const char *udev_device_get_subsystem(struct udev_device *udev_device);
const char *udev_device_get_devtype(struct udev_device *udev_device);
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 8db287b141..ed6f203ce7 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -811,6 +811,10 @@ void udev_event_execute_rules(struct udev_event *event,
return;
if (streq(udev_device_get_action(dev), "remove")) {
+ udev_device_read_db(dev);
+ udev_device_tag_index(dev, NULL, false);
+ udev_device_delete_db(dev);
+
if (major(udev_device_get_devnum(dev)) != 0)
udev_watch_end(event->udev, dev);
@@ -821,9 +825,6 @@ void udev_event_execute_rules(struct udev_event *event,
if (major(udev_device_get_devnum(dev)) != 0)
udev_node_remove(dev);
-
- udev_device_delete_db(dev);
- udev_device_tag_index(dev, NULL, false);
} else {
event->dev_db = udev_device_clone_with_db(dev);
if (event->dev_db != NULL) {