chiark / gitweb /
gpt-auto-generator: use EBADSLT code when unable to detect partition type
[elogind.git] / src / gpt-auto-generator / gpt-auto-generator.c
index 3cbafa4d51f86bb45645060b4b0307a38d1ac41f..05934da82f8a18a8495bbade7ebe4357112811f9 100644 (file)
@@ -24,7 +24,7 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/statfs.h>
-#include <blkid.h>
+#include <blkid/blkid.h>
 
 #ifdef HAVE_LINUX_BTRFS_H
 #include <linux/btrfs.h>
@@ -74,10 +74,8 @@ static int verify_gpt_partition(const char *node, sd_id128_t *type, unsigned *nr
 
         errno = 0;
         r = blkid_do_safeprobe(b);
-        if (r == -2)
-                return -ENODEV;
-        else if (r == 1)
-                return -ENODEV;
+        if (r == -2 || r == 1) /* no result or uncertain */
+                return -EBADSLT;
         else if (r != 0)
                 return errno ? -errno : -EIO;
 
@@ -297,6 +295,9 @@ static int enumerate_partitions(struct udev *udev, dev_t dev) {
 
                 r = verify_gpt_partition(node, &type_id, &nr, &fstype);
                 if (r < 0) {
+                        /* skip child devices which are not detected properly */
+                        if (r == -EBADSLT)
+                                continue;
                         log_error("Failed to verify GPT partition %s: %s",
                                   node, strerror(-r));
                         return r;