From: kay.sievers@vrfy.org Date: Sat, 30 Oct 2004 11:44:46 +0000 (+0200) Subject: [PATCH] Exit, if udevtest cannot open the device (segfault). X-Git-Tag: 043~12 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5e2ea95a4b21ebc5297881e7e8c5ab4425bac5e;p=systemd [PATCH] Exit, if udevtest cannot open the device (segfault). --- diff --git a/udevtest.c b/udevtest.c index f2b0c98e..8af2120f 100644 --- a/udevtest.c +++ b/udevtest.c @@ -108,10 +108,12 @@ int main(int argc, char *argv[], char *envp[]) /* open the device */ snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, udev.devpath); class_dev = sysfs_open_class_device_path(path); - if (class_dev == NULL) - dbg ("sysfs_open_class_device_path failed"); - else - dbg("opened class_dev->name='%s'", class_dev->name); + if (class_dev == NULL) { + info("sysfs_open_class_device_path failed"); + return 1; + } + + dbg("opened class_dev->name='%s'", class_dev->name); /* simulate node creation with test flag */ udev.test_run = 1;