From 4526113f57d72f0670c7e0449cfee943e9ab6e5c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 21 Mar 2018 12:10:01 +0100 Subject: dissect: add dissect_image_and_warn() that unifies error message generation for dissect_image() (#8517) --- src/dissect/dissect.c | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'src/dissect/dissect.c') diff --git a/src/dissect/dissect.c b/src/dissect/dissect.c index c8fb1c80d7..4dde773b56 100644 --- a/src/dissect/dissect.c +++ b/src/dissect/dissect.c @@ -202,31 +202,9 @@ int main(int argc, char *argv[]) { } } - r = dissect_image(d->fd, arg_root_hash, arg_root_hash_size, arg_flags, &m); - if (r == -ENOPKG) { - log_error_errno(r, "Couldn't identify a suitable partition table or file system in %s.", arg_image); + r = dissect_image_and_warn(d->fd, arg_image, arg_root_hash, arg_root_hash_size, arg_flags, &m); + if (r < 0) goto finish; - } - if (r == -EADDRNOTAVAIL) { - log_error_errno(r, "No root partition for specified root hash found in %s.", arg_image); - goto finish; - } - if (r == -ENOTUNIQ) { - log_error_errno(r, "Multiple suitable root partitions found in image %s.", arg_image); - goto finish; - } - if (r == -ENXIO) { - log_error_errno(r, "No suitable root partition found in image %s.", arg_image); - goto finish; - } - if (r == -EPROTONOSUPPORT) { - log_error_errno(r, "Device %s is loopback block device with partition scanning turned off, please turn it on.", arg_image); - goto finish; - } - if (r < 0) { - log_error_errno(r, "Failed to dissect image: %m"); - goto finish; - } switch (arg_action) { -- cgit v1.2.3