ryantimwilson / rpms / systemd

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