summaryrefslogtreecommitdiffstats
path: root/src/dissect/dissect.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-03-21 12:10:01 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-03-21 12:10:01 +0100
commit4526113f57d72f0670c7e0449cfee943e9ab6e5c (patch)
tree43766fb3b5b38d310fb69e68cd968554ccbf4fca /src/dissect/dissect.c
parentmove MANAGER_IS_RELOADING() check into manager_recheck_{dbus|journal}() (#8510) (diff)
downloadsystemd-4526113f57d72f0670c7e0449cfee943e9ab6e5c.tar.xz
systemd-4526113f57d72f0670c7e0449cfee943e9ab6e5c.zip
dissect: add dissect_image_and_warn() that unifies error message generation for dissect_image() (#8517)
Diffstat (limited to 'src/dissect/dissect.c')
-rw-r--r--src/dissect/dissect.c26
1 files changed, 2 insertions, 24 deletions
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) {