diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-02-21 16:41:33 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-02-21 16:41:33 -0500 |
commit | b382db9f3b1f1ffa33ed4970cf2e01d2ee4e8d88 (patch) | |
tree | b7024b52728909e7fd9998ed63e19a16addca315 /src/shared/dissect-image.c | |
parent | a3d8d68cc1698d014575f0f66c58e253bd46c240 (diff) | |
download | systemd-b382db9f3b1f1ffa33ed4970cf2e01d2ee4e8d88.tar.gz |
tree-wide: simplify handling of blkid errors
Diffstat (limited to 'src/shared/dissect-image.c')
-rw-r--r-- | src/shared/dissect-image.c | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c index 410a7764ed..39e724c51a 100644 --- a/src/shared/dissect-image.c +++ b/src/shared/dissect-image.c @@ -61,12 +61,8 @@ static int probe_filesystem(const char *node, char **ret_fstype) { log_debug("Failed to identify any partition type on partition %s", node); goto not_found; } - if (r != 0) { - if (errno == 0) - return -EIO; - - return -errno; - } + if (r != 0) + return -errno ?: -EIO; (void) blkid_probe_lookup_value(b, "TYPE", &fstype, NULL); @@ -146,12 +142,8 @@ int dissect_image(int fd, const void *root_hash, size_t root_hash_size, DissectI errno = 0; r = blkid_probe_set_device(b, fd, 0, 0); - if (r != 0) { - if (errno == 0) - return -ENOMEM; - - return -errno; - } + if (r != 0) + return -errno ?: -ENOMEM; if ((flags & DISSECT_IMAGE_GPT_ONLY) == 0) { /* Look for file system superblocks, unless we only shall look for GPT partition tables */ @@ -168,12 +160,8 @@ int dissect_image(int fd, const void *root_hash, size_t root_hash_size, DissectI log_debug("Failed to identify any partition table."); return -ENOPKG; } - if (r != 0) { - if (errno == 0) - return -EIO; - - return -errno; - } + if (r != 0) + return -errno ?: -EIO; m = new0(DissectedImage, 1); if (!m) @@ -232,12 +220,8 @@ int dissect_image(int fd, const void *root_hash, size_t root_hash_size, DissectI errno = 0; pl = blkid_probe_get_partitions(b); - if (!pl) { - if (errno == 0) - return -ENOMEM; - - return -errno; - } + if (!pl) + return -errno ?: -ENOMEM; udev = udev_new(); if (!udev) |