X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=wait_for_sysfs.c;h=3b1b0cd24809a249700c284746cf7dbdf5714760;hb=9dfe20eff709a251da92c473ea94615887497e0a;hp=e7eed441eee628bfac670aae6988fbfd9282a54e;hpb=f071348004c8069b610effd95309ff47c515cf3e;p=elogind.git diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index e7eed441e..3b1b0cd24 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -99,6 +99,12 @@ int main(int argc, char *argv[], char *envp[]) snprintf(filename, SYSFS_PATH_MAX-1, "%s%s", sysfs_mnt_path, devpath); filename[SYSFS_PATH_MAX-1] = '\0'; + /* skip bad events where we get no device for the class */ + if (strncmp(devpath, "/class/", 7) == 0 && strchr(&devpath[7], '/') == NULL) { + dbg("no device name for '%s', bad event", devpath); + goto exit; + } + /* open the class device we are called for */ class_dev = open_class_device_wait(filename); if (!class_dev) { @@ -110,6 +116,15 @@ int main(int argc, char *argv[], char *envp[]) /* wait for the class device with possible physical device and bus */ wait_for_class_device(class_dev, &error); + /* + * we got too many unfixable class/net errors, kernel later than 2.6.10-rc1 will + * solve this by exporting the needed information with the hotplug event + * until we use this just don't print any error for net devices, but still + * wait for it. + */ + if (strncmp(devpath, "/class/net/", 11) == 0) + error = NULL; + sysfs_close_class_device(class_dev); } else if ((strncmp(devpath, "/devices/", 9) == 0)) {