diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-09-01 16:12:47 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-09-23 10:18:50 +0200 |
commit | 2c740afd1613a7ab5e70e39251767a3429c543cc (patch) | |
tree | 222bde46a1c7c3005ef57f31324feccb93e44ae6 /src/cryptsetup | |
parent | logind-acl: replace strdup()+set_consume() by set_put_strdup() (diff) | |
download | systemd-2c740afd1613a7ab5e70e39251767a3429c543cc.tar.xz systemd-2c740afd1613a7ab5e70e39251767a3429c543cc.zip |
tree-wide: do not assign unused return values
Diffstat (limited to 'src/cryptsetup')
-rw-r--r-- | src/cryptsetup/cryptsetup.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c index a622db849b..b590d70676 100644 --- a/src/cryptsetup/cryptsetup.c +++ b/src/cryptsetup/cryptsetup.c @@ -271,7 +271,6 @@ static int parse_options(const char *options) { } static char* disk_description(const char *path) { - static const char name_fields[] = "ID_PART_ENTRY_NAME\0" "DM_NAME\0" @@ -279,9 +278,8 @@ static char* disk_description(const char *path) { "ID_MODEL\0"; _cleanup_(sd_device_unrefp) sd_device *device = NULL; + const char *i, *name; struct stat st; - const char *i; - int r; assert(path); @@ -291,17 +289,13 @@ static char* disk_description(const char *path) { if (!S_ISBLK(st.st_mode)) return NULL; - r = sd_device_new_from_devnum(&device, 'b', st.st_rdev); - if (r < 0) + if (sd_device_new_from_devnum(&device, 'b', st.st_rdev) < 0) return NULL; - NULSTR_FOREACH(i, name_fields) { - const char *name; - - r = sd_device_get_property_value(device, i, &name); - if (r >= 0 && !isempty(name)) + NULSTR_FOREACH(i, name_fields) + if (sd_device_get_property_value(device, i, &name) >= 0 && + !isempty(name)) return strdup(name); - } return NULL; } |