daandemeyer / rpms / systemd

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