summaryrefslogtreecommitdiff
path: root/udev_multiplex.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2004-11-25 09:55:54 +0100
committerGreg KH <gregkh@suse.de>2005-04-26 22:47:02 -0700
commit7757db1f859616171693ed9a54d1d16d3d5ed8e9 (patch)
treeb85e4e2ab01e5b5df3d06bb7e1477c0f2298e27f /udev_multiplex.c
parent9aa0485c97d1b02a39550e3be31c37520a0d0620 (diff)
[PATCH] don't call dev.d/ scripts twice, if directory = subsystem
The /etc/dev.d/input/input.dev was called twice for /dev/input/mouse. Skip the execution if we get a directory named after the subsystem. Move UDEV_NO_DEVD where it belongs.
Diffstat (limited to 'udev_multiplex.c')
-rw-r--r--udev_multiplex.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/udev_multiplex.c b/udev_multiplex.c
index 7e3dc656d6..3a484068ff 100644
--- a/udev_multiplex.c
+++ b/udev_multiplex.c
@@ -74,26 +74,28 @@ static int run_program(const char *filename, void *data)
void udev_multiplex_directory(struct udevice *udev, const char *basedir, const char *suffix)
{
char dirname[PATH_MAX];
- char devname[NAME_SIZE];
- char *temp;
-
- /* skip if UDEV_NO_DEVD is set */
- if (udev_dev_d == 0)
- return;
-
- strfieldcpy(devname, udev->name);
/* chop the device name up into pieces based on '/' */
- temp = strchr(devname, '/');
- while (temp != NULL) {
- temp[0] = '\0';
- snprintf(dirname, PATH_MAX, "%s/%s", basedir, devname);
- dirname[PATH_MAX-1] = '\0';
- call_foreach_file(run_program, dirname, suffix, udev);
-
- temp[0] = '/';
- ++temp;
- temp = strchr(temp, '/');
+ if (udev->name[0] != '\0') {
+ char devname[NAME_SIZE];
+ char *temp;
+
+ strfieldcpy(devname, udev->name);
+ temp = strchr(devname, '/');
+ while (temp != NULL) {
+ temp[0] = '\0';
+
+ /* don't call the subsystem directory here */
+ if (strcmp(devname, udev->subsystem) != 0) {
+ snprintf(dirname, PATH_MAX, "%s/%s", basedir, devname);
+ dirname[PATH_MAX-1] = '\0';
+ call_foreach_file(run_program, dirname, suffix, udev);
+ }
+
+ temp[0] = '/';
+ ++temp;
+ temp = strchr(temp, '/');
+ }
}
if (udev->name[0] != '\0') {