From 167387fd92cc204a38bc0afa75b66889dec3decf Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Thu, 5 Apr 2007 15:35:30 +1000 Subject: [PATCH] Ignore ramdisk devices. Don't try and parse the config from ramdisk devices, and add a general system for device ignoring. Signed-off-by: Jeremy Kerr --- devices/udev-helper.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/devices/udev-helper.c b/devices/udev-helper.c index d70a1d7..84b2bef 100644 --- a/devices/udev-helper.c +++ b/devices/udev-helper.c @@ -401,6 +401,18 @@ static int is_removable_device(const char *sysfs_path) return strtol(buf, NULL, 10); } +static int is_ignored_device(const char *devname) +{ + static const char *ignored_devices[] = { "/dev/ram", NULL }; + const char **dev; + + for (dev = ignored_devices; *dev; dev++) + if (!strncmp(devname, *dev, strlen(*dev))) + return 1; + + return 0; +} + static int found_new_device(const char *dev_path) { char mountpoint[PATH_MAX]; @@ -573,6 +585,9 @@ int main(int argc, char **argv) return EXIT_FAILURE; } + if (is_ignored_device(dev_path)) + return EXIT_SUCCESS; + if (streq(action, "add")) { char *sysfs_path = getenv("DEVPATH"); if (sysfs_path && is_removable_device(sysfs_path)) -- 2.39.2