|
Zbigniew Jędrzejewski-Szmek |
399a2a |
From 1261a8df61818d48c6bc9445a16b40e24ffaa74e Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
Date: Fri, 13 Mar 2015 21:10:13 -0500
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
Subject: [PATCH] gpt-auto-generator: allow type check to fail
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
add_mount() is OK with unknow file type, but we have to initalize
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
the variable to NULL not to pass garbage on error.
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
(cherry picked from commit a0b1209c4a59754f428894e0485413542da50014)
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
---
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
src/gpt-auto-generator/gpt-auto-generator.c | 13 +++++--------
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
1 file changed, 5 insertions(+), 8 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
index 869a230f17..e0a5bb305b 100644
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
--- a/src/gpt-auto-generator/gpt-auto-generator.c
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
@@ -290,7 +290,7 @@ static int probe_and_add_mount(
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
const char *post) {
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
_cleanup_blkid_free_probe_ blkid_probe b = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
- const char *fstype;
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
+ const char *fstype = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
int r;
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
assert(id);
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
@@ -323,14 +323,11 @@ static int probe_and_add_mount(
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
r = blkid_do_safeprobe(b);
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
if (r == -2 || r == 1) /* no result or uncertain */
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
- else if (r != 0) {
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
- if (errno == 0)
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
- errno = EIO;
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
- log_error_errno(errno, "Failed to probe %s: %m", what);
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
- return -errno;
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
- }
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
+ else if (r != 0)
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
+ return log_error_errno(errno ?: EIO, "Failed to probe %s: %m", what);
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
- blkid_probe_lookup_value(b, "TYPE", &fstype, NULL);
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
+ /* add_mount is OK with fstype being NULL. */
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
+ (void) blkid_probe_lookup_value(b, "TYPE", &fstype, NULL);
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
return add_mount(
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
id,
|