X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=udev.c;h=1c55ec14b8764ec898734cf2fd236deb056206b2;hb=319c6700165dc38d7f813ff646bff0196f2aafe6;hp=f7b9bf3573e0e66a71b6e44fe9fc9689a75a8439;hpb=8ab44e3fd0b8fd4555db973d4c2c305ca09e787d;p=elogind.git diff --git a/udev.c b/udev.c index f7b9bf357..1c55ec14b 100644 --- a/udev.c +++ b/udev.c @@ -179,34 +179,32 @@ int main(int argc, char *argv[], char *envp[]) /* export name of device node or netif */ if (udev.devname[0] != '\0') setenv("DEVNAME", udev.devname, 1); - } else if (udev.type == DEV_DEVICE) { - if (strcmp(action, "add") == 0) { - struct sysfs_device *devices_dev; - - /* wait for sysfs of /sys/devices/ */ - dbg("devices add"); - snprintf(path, sizeof(path), "%s%s", sysfs_path, devpath); - path[sizeof(path)-1] = '\0'; - devices_dev = wait_devices_device_open(path); - if (!devices_dev) { - dbg("devices device unavailable (probably remove has beaten us)"); - goto run; - } - dbg("devices device opened '%s'", path); - wait_for_devices_device(devices_dev, &error); - udev_rules_get_run(&udev, devices_dev); - sysfs_close_device(devices_dev); - if (udev.ignore_device) { - info("device event will be ignored"); - goto cleanup; - } - } else if (strcmp(action, "remove") == 0) { - dbg("devices remove"); - udev_rules_get_run(&udev, NULL); - if (udev.ignore_device) { - info("device event will be ignored"); - goto cleanup; - } + } else if (udev.type == DEV_DEVICE && strcmp(action, "add") == 0) { + struct sysfs_device *devices_dev; + + /* wait for sysfs of /sys/devices/ */ + dbg("devices add"); + snprintf(path, sizeof(path), "%s%s", sysfs_path, devpath); + path[sizeof(path)-1] = '\0'; + devices_dev = wait_devices_device_open(path); + if (!devices_dev) { + dbg("devices device unavailable (probably remove has beaten us)"); + goto run; + } + dbg("devices device opened '%s'", path); + wait_for_devices_device(devices_dev, &error); + udev_rules_get_run(&udev, devices_dev); + sysfs_close_device(devices_dev); + if (udev.ignore_device) { + info("device event will be ignored"); + goto cleanup; + } + } else { + dbg("default handling"); + udev_rules_get_run(&udev, NULL); + if (udev.ignore_device) { + info("device event will be ignored"); + goto cleanup; } } @@ -216,7 +214,7 @@ run: dbg("executing run list"); list_for_each_entry(name_loop, &udev.run_list, node) - execute_command(name_loop->name, udev.subsystem); + execute_program(name_loop->name, udev.subsystem, NULL, 0, NULL); } cleanup: