diff options
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/dissect-image.c | 32 | ||||
-rw-r--r-- | src/shared/fstab-util.c | 2 | ||||
-rw-r--r-- | src/shared/machine-image.c | 4 |
3 files changed, 11 insertions, 27 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) diff --git a/src/shared/fstab-util.c b/src/shared/fstab-util.c index 87b520b540..c3106f1ae9 100644 --- a/src/shared/fstab-util.c +++ b/src/shared/fstab-util.c @@ -213,7 +213,7 @@ static char *unquote(const char *s, const char* quotes) { * trailing quotes if there is one. Doesn't care about * escaping or anything. * - * DON'T USE THIS FOR NEW CODE ANYMORE!*/ + * DON'T USE THIS FOR NEW CODE ANYMORE! */ l = strlen(s); if (l < 2) diff --git a/src/shared/machine-image.c b/src/shared/machine-image.c index d96ff44e66..32a4c67590 100644 --- a/src/shared/machine-image.c +++ b/src/shared/machine-image.c @@ -636,7 +636,7 @@ int image_clone(Image *i, const char *new_name, bool read_only) { case IMAGE_SUBVOLUME: case IMAGE_DIRECTORY: /* If we can we'll always try to create a new btrfs subvolume here, even if the source is a plain - * directory.*/ + * directory. */ new_path = strjoina("/var/lib/machines/", new_name); @@ -712,7 +712,7 @@ int image_read_only(Image *i, bool b) { use the "immutable" flag, to at least make the top-level directory read-only. It's not as good as a read-only subvolume, but at least something, and - we can read the value back.*/ + we can read the value back. */ r = chattr_path(i->path, b ? FS_IMMUTABLE_FL : 0, FS_IMMUTABLE_FL); if (r < 0) |