diff options
-rw-r--r-- | src/partition/growfs.c | 2 | ||||
-rw-r--r-- | src/partition/makefs.c | 6 | ||||
-rw-r--r-- | src/shared/dissect-image.c | 16 |
3 files changed, 19 insertions, 5 deletions
diff --git a/src/partition/growfs.c b/src/partition/growfs.c index f9c604ca6f..8b44c1ded7 100644 --- a/src/partition/growfs.c +++ b/src/partition/growfs.c @@ -151,6 +151,8 @@ static int maybe_resize_slave_device(const char *mountpath, dev_t main_devno) { xsprintf_dev_num_path(devpath, "block", devno); r = probe_filesystem(devpath, &fstype); + if (r == -EUCLEAN) + return log_warning_errno(r, "Cannot reliably determine probe \"%s\", refusing to proceed.", devpath); if (r < 0) return log_warning_errno(r, "Failed to probe \"%s\": %m", devpath); diff --git a/src/partition/makefs.c b/src/partition/makefs.c index c24c6ebcde..e5e125255b 100644 --- a/src/partition/makefs.c +++ b/src/partition/makefs.c @@ -90,7 +90,11 @@ int main(int argc, char *argv[]) { r = probe_filesystem(device, &detected); if (r < 0) { - log_warning_errno(r, "Failed to probe \"%s\": %m", device); + log_warning_errno(r, + r == -EUCLEAN ? + "Cannot reliably determine probe \"%s\", refusing to proceed." : + "Failed to probe \"%s\": %m", + device); goto finish; } diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c index 3c16f60b83..7835d99020 100644 --- a/src/shared/dissect-image.c +++ b/src/shared/dissect-image.c @@ -52,6 +52,10 @@ #include "xattr-util.h" int probe_filesystem(const char *node, char **ret_fstype) { + /* Try to find device content type and return it in *ret_fstype. If nothing is found, + * 0/NULL will be returned. -EUCLEAN will be returned for ambigous results, and an + * different error otherwise. */ + #if HAVE_BLKID _cleanup_blkid_free_probe_ blkid_probe b = NULL; const char *fstype; @@ -67,10 +71,14 @@ int probe_filesystem(const char *node, char **ret_fstype) { errno = 0; r = blkid_do_safeprobe(b); - if (IN_SET(r, -2, 1)) { - log_debug("Failed to identify any partition type on partition %s", node); + if (r == 1) { + log_debug("No type detected on partition %s", node); goto not_found; } + if (r == -2) { + log_debug("Results ambiguous for partition %s", node); + return -EUCLEAN; + } if (r != 0) return -errno ?: -EIO; @@ -608,7 +616,7 @@ int dissect_image(int fd, const void *root_hash, size_t root_hash_size, DissectI if (!p->fstype && p->node) { r = probe_filesystem(p->node, &p->fstype); - if (r < 0) + if (r < 0 && r != -EUCLEAN) return r; } @@ -1018,7 +1026,7 @@ int dissected_image_decrypt( if (!p->decrypted_fstype && p->decrypted_node) { r = probe_filesystem(p->decrypted_node, &p->decrypted_fstype); - if (r < 0) + if (r < 0 && r != -EUCLEAN) return r; } } |