]> err.no Git - util-linux/commitdiff
blkid: report open() errors in low-level probing
authorKarel Zak <kzak@redhat.com>
Tue, 16 Feb 2010 08:43:26 +0000 (09:43 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 16 Feb 2010 08:43:26 +0000 (09:43 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/blkid.c

index 28baa2a0225e08f2a9419d7283b4b65978f85dff..8c66e0a8334a442e862dabc66e7b7c6c0abb38a6 100644 (file)
@@ -17,6 +17,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <termios.h>
+#include <errno.h>
 #ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
 #endif
@@ -413,9 +414,10 @@ static int lowprobe_device(blkid_probe pr, const char *devname,    char *show[],
        struct stat st;
 
        fd = open(devname, O_RDONLY);
-       if (fd < 0)
+       if (fd < 0) {
+               fprintf(stderr, "error: %s: %s\n", devname, strerror(errno));
                return 2;
-
+       }
        if (blkid_probe_set_device(pr, fd, offset, size))
                goto done;