systemd/0235-gpt-auto-generator-use-EBADSLT-code-when-unable-to-d.patch

39 lines
1.6 KiB
Diff
Raw Normal View History

From 15ef380be7e38898fe2aef4ae3aa6fb0ce804564 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sat, 11 Jan 2014 16:45:29 -0500
Subject: [PATCH] gpt-auto-generator: use EBADSLT code when unable to detect
partition type
ENODEV suggests that something is missing, which is be misleading
here.
---
src/gpt-auto-generator/gpt-auto-generator.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
index 0e8e959..d7c09f0 100644
--- a/src/gpt-auto-generator/gpt-auto-generator.c
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
@@ -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;
@@ -299,7 +297,7 @@ 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 == -ENODEV)
+ if (r == -EBADSLT)
continue;
log_error("Failed to verify GPT partition %s: %s",
node, strerror(-r));