chiark / gitweb /
[PATCH] add /etc/dev.d/ support for udev add and remove events.
[elogind.git] / udev-remove.c
index 93adcc7..dc6fcfc 100644 (file)
@@ -29,6 +29,7 @@
 #include <errno.h>
 
 #include "udev.h"
+#include "udev_lib.h"
 #include "udev_version.h"
 #include "udev_dbus.h"
 #include "logging.h"
@@ -72,7 +73,8 @@ static int delete_node(struct udevice *dev)
        char partitionname[NAME_SIZE];
        int retval;
        int i;
-       int pos, len;
+       char *pos;
+       int len;
 
        strfieldcpy(filename, udev_root);
        strfieldcat(filename, dev->name);
@@ -102,7 +104,7 @@ static int delete_node(struct udevice *dev)
                delete_path(filename);
 
        foreach_strpart(dev->symlink, " ", pos, len) {
-               strnfieldcpy(linkname, dev->symlink + pos, len+1);
+               strfieldcpymax(linkname, pos, len+1);
                strfieldcpy(filename, udev_root);
                strfieldcat(filename, linkname);
 
@@ -148,6 +150,7 @@ int udev_remove_device(char *path, char *subsystem)
        dbg("name is '%s'", dev.name);
        udevdb_delete_dev(path);
 
+       dev_d_send(&dev, subsystem);
        sysbus_send_remove(dev.name, path);
 
        retval = delete_node(&dev);