gpt-auto-generator: allow type check to fail

add_mount() is OK with unknow file type, but we have to initalize
the variable to NULL not to pass garbage on error.

(cherry picked from commit a0b1209c4a)
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2015-03-14 11:27:19 -04:00
parent 12e474fdf3
commit 1261a8df61
+5 -8
View File
@@ -290,7 +290,7 @@ static int probe_and_add_mount(
const char *post) {
_cleanup_blkid_free_probe_ blkid_probe b = NULL;
const char *fstype;
const char *fstype = NULL;
int r;
assert(id);
@@ -323,14 +323,11 @@ static int probe_and_add_mount(
r = blkid_do_safeprobe(b);
if (r == -2 || r == 1) /* no result or uncertain */
return 0;
else if (r != 0) {
if (errno == 0)
errno = EIO;
log_error_errno(errno, "Failed to probe %s: %m", what);
return -errno;
}
else if (r != 0)
return log_error_errno(errno ?: EIO, "Failed to probe %s: %m", what);
blkid_probe_lookup_value(b, "TYPE", &fstype, NULL);
/* add_mount is OK with fstype being NULL. */
(void) blkid_probe_lookup_value(b, "TYPE", &fstype, NULL);
return add_mount(
id,