From 8d4a8d195ddcf34e5ff8a9602994ad6737f40df8 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 16 Mar 2010 18:37:19 +0100 Subject: [PATCH] mdev: fix a trivial SEGV Signed-off-by: Denys Vlasenko --- util-linux/mdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util-linux/mdev.c b/util-linux/mdev.c index 9c9d95f8a..3cee3a669 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c @@ -140,7 +140,7 @@ static void make_device(char *path, int delete) * But since 2.6.25 block devices are also in /sys/class/block. * We use strstr("/block/") to forestall future surprises. */ type = S_IFCHR; - if (strstr(path, "/block/") || strncmp(G.subsystem, "block", 5) == 0) + if (strstr(path, "/block/") || (G.subsystem && strncmp(G.subsystem, "block", 5) == 0)) type = S_IFBLK; /* Make path point to "subsystem/device_name" */ -- 2.25.1