device matching against UUIDs: do not try floppies
authorDenys Vlasenko <vda.linux@googlemail.com>
Sat, 27 Jun 2009 19:58:25 +0000 (21:58 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sat, 27 Jun 2009 19:58:25 +0000 (21:58 +0200)
function                                             old     new   delta
uuidcache_check_device                               255     292     +37

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
util-linux/volume_id/get_devname.c

index ac69f78..181b6db 100644 (file)
@@ -86,9 +86,16 @@ uuidcache_check_device(const char *device,
        char *label = label;
        int fd;
 
+       /* note: this check rejects links to devices, among other nodes */
        if (!S_ISBLK(statbuf->st_mode))
                return TRUE;
 
+       /* Users report that mucking with floppies (especially non-present
+        * ones) is significant PITA. This is a horribly dirty hack,
+        * but it is very useful in real world. */
+       if (major(statbuf->st_rdev) == 2)
+               return TRUE;
+
        fd = open(device, O_RDONLY);
        if (fd < 0)
                return TRUE;