diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-09-01 16:07:18 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-09-23 10:18:50 +0200 |
commit | 8090b41ed534ad00433ef56445f2a61e121baddd (patch) | |
tree | 2a4ba297e52a3550e068668c79f1850f7e236c34 /src/gpt-auto-generator/gpt-auto-generator.c | |
parent | tree-wide: use streq() instead of streq_ptr() (diff) | |
download | systemd-8090b41ed534ad00433ef56445f2a61e121baddd.tar.xz systemd-8090b41ed534ad00433ef56445f2a61e121baddd.zip |
gpt-auto-generator: do not assign '*ret' on error
Diffstat (limited to 'src/gpt-auto-generator/gpt-auto-generator.c')
-rw-r--r-- | src/gpt-auto-generator/gpt-auto-generator.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c index a088df811f..6b75221426 100644 --- a/src/gpt-auto-generator/gpt-auto-generator.c +++ b/src/gpt-auto-generator/gpt-auto-generator.c @@ -462,34 +462,34 @@ static int open_parent(dev_t devnum, int *ret) { r = sd_device_get_syspath(d, &name); if (r < 0) { log_debug_errno(r, "Device %u:%u does not have a name, ignoring: %m", major(devnum), minor(devnum)); - goto not_found; + return 0; } } r = sd_device_get_parent(d, &parent); if (r < 0) { log_debug_errno(r, "%s: not a partitioned device, ignoring: %m", name); - goto not_found; + return 0; } /* Does it have a devtype? */ r = sd_device_get_devtype(parent, &devtype); if (r < 0) { log_debug_errno(r, "%s: parent doesn't have a device type, ignoring: %m", name); - goto not_found; + return 0; } /* Is this a disk or a partition? We only care for disks... */ if (!streq(devtype, "disk")) { log_debug("%s: parent isn't a raw disk, ignoring.", name); - goto not_found; + return 0; } /* Does it have a device node? */ r = sd_device_get_devname(parent, &node); if (r < 0) { log_debug_errno(r, "%s: parent device does not have device node, ignoring: %m", name); - goto not_found; + return 0; } log_debug("%s: root device %s.", name, node); @@ -497,7 +497,7 @@ static int open_parent(dev_t devnum, int *ret) { r = sd_device_get_devnum(parent, &pn); if (r < 0) { log_debug_errno(r, "%s: parent device is not a proper block device, ignoring: %m", name); - goto not_found; + return 0; } fd = open(node, O_RDONLY|O_CLOEXEC|O_NOCTTY); @@ -506,14 +506,9 @@ static int open_parent(dev_t devnum, int *ret) { *ret = fd; return 1; - -not_found: - *ret = -1; - return 0; } static int enumerate_partitions(dev_t devnum) { - _cleanup_close_ int fd = -1; _cleanup_(dissected_image_unrefp) DissectedImage *m = NULL; int r, k; |