9fc0f6
From 59250a9f6ac82b91cae43ae6a022298df1a67ee1 Mon Sep 17 00:00:00 2001
9fc0f6
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
9fc0f6
Date: Sat, 11 Jan 2014 16:45:29 -0500
9fc0f6
Subject: [PATCH] gpt-auto-generator: use EBADSLT code when unable to detect
9fc0f6
 partition type
9fc0f6
9fc0f6
ENODEV suggests that something is missing, which is be misleading
9fc0f6
here.
9fc0f6
---
9fc0f6
 src/gpt-auto-generator/gpt-auto-generator.c | 8 +++-----
9fc0f6
 1 file changed, 3 insertions(+), 5 deletions(-)
9fc0f6
9fc0f6
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
9fc0f6
index 1f09aed..f1749be 100644
9fc0f6
--- a/src/gpt-auto-generator/gpt-auto-generator.c
9fc0f6
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
9fc0f6
@@ -73,10 +73,8 @@ static int verify_gpt_partition(const char *node, sd_id128_t *type, unsigned *nr
9fc0f6
 
9fc0f6
         errno = 0;
9fc0f6
         r = blkid_do_safeprobe(b);
9fc0f6
-        if (r == -2)
9fc0f6
-                return -ENODEV;
9fc0f6
-        else if (r == 1)
9fc0f6
-                return -ENODEV;
9fc0f6
+        if (r == -2 || r == 1) /* no result or uncertain */
9fc0f6
+                return -EBADSLT;
9fc0f6
         else if (r != 0)
9fc0f6
                 return errno ? -errno : -EIO;
9fc0f6
 
9fc0f6
@@ -307,7 +305,7 @@ static int enumerate_partitions(struct udev *udev, dev_t dev) {
9fc0f6
                 r = verify_gpt_partition(node, &type_id, &nr, &fstype);
9fc0f6
                 if (r < 0) {
9fc0f6
                         /* skip child devices which are not detected properly */
9fc0f6
-                        if (r == -ENODEV)
9fc0f6
+                        if (r == -EBADSLT)
9fc0f6
                                 continue;
9fc0f6
                         log_error("Failed to verify GPT partition %s: %s",
9fc0f6
                                   node, strerror(-r));