diff options
author | Kay Sievers <kay.sievers@suse.de> | 2006-09-03 04:44:33 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@suse.de> | 2006-09-03 04:44:33 +0200 |
commit | 051445e078ab1a6d0cbbc1bd7f1a6fbd80e8bed1 (patch) | |
tree | c48ad168a0cfb3c048deb1b6a4a1fde8d0ee71f8 /udevtrigger.c | |
parent | 11f1bb5ab42571fae5cc607d42b8d918c9e170ab (diff) |
udevd: use files instead of symlinks for /dev/.udev/queue,failed
Diffstat (limited to 'udevtrigger.c')
-rw-r--r-- | udevtrigger.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/udevtrigger.c b/udevtrigger.c index 571bcadfc5..64a2ebdd72 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -433,30 +433,30 @@ static void scan_failed(void) struct dirent *dent; strlcpy(base, udev_root, sizeof(base)); - strlcat(base, "/", sizeof(base)); - strlcat(base, EVENT_FAILED_DIR, sizeof(base)); + strlcat(base, "/" EVENT_FAILED_DIR, sizeof(base)); dir = opendir(base); if (dir != NULL) { for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char linkname[PATH_SIZE]; - char target[PATH_SIZE]; - int len; + char device[PATH_SIZE]; + size_t start, end, i; if (dent->d_name[0] == '.') continue; - strlcpy(linkname, base, sizeof(linkname)); - strlcat(linkname, "/", sizeof(linkname)); - strlcat(linkname, dent->d_name, sizeof(linkname)); + strlcpy(device, sysfs_path, sizeof(device)); + start = strlcat(device, "/", sizeof(device)); + end = strlcat(device, dent->d_name, sizeof(device)); + if (end > sizeof(device)) + end = sizeof(device); - len = readlink(linkname, target, sizeof(target)); - if (len <= 0) - continue; - target[len] = '\0'; + /* replace PATH_TO_NAME_CHAR with '/' */ + for (i = start; i < end; i++) + if (device[i] == PATH_TO_NAME_CHAR) + device[i] = '/'; - if (is_device(target)) - device_list_insert(target); + if (is_device(device)) + device_list_insert(device); else continue; } |