From 8673dcb84299fd2adba6281c5359bed4399d5b2d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 12 Nov 2004 06:21:16 +0100 Subject: [PATCH] Make dev.d/ handling a separate processing stage Move the logic when and how to call the dev.d/ scripts into the main processing path. --- udevstart.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'udevstart.c') diff --git a/udevstart.c b/udevstart.c index 0433e568d4..c1d877fb37 100644 --- a/udevstart.c +++ b/udevstart.c @@ -97,7 +97,8 @@ static int add_device(char *devpath, char *subsystem) setenv("DEVPATH", devpath, 1); setenv("SUBSYSTEM", subsystem, 1); - snprintf(path, SYSFS_PATH_MAX-1, "%s%s", sysfs_path, devpath); + snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, devpath); + path[SYSFS_PATH_MAX-1] = '\0'; class_dev = sysfs_open_class_device_path(path); if (class_dev == NULL) { dbg ("sysfs_open_class_device_path failed"); @@ -107,8 +108,11 @@ static int add_device(char *devpath, char *subsystem) udev_set_values(&udev, devpath, subsystem, "add"); udev_add_device(&udev, class_dev); - /* run scripts */ - dev_d_execute(&udev); + /* run dev.d/ scripts if we created a node or changed a netif name */ + if (udev.devname[0] != '\0') { + setenv("DEVNAME", udev.devname, 1); + dev_d_execute(&udev, DEVD_DIR, DEVD_SUFFIX); + } sysfs_close_class_device(class_dev); -- cgit v1.2.3-54-g00ecf