1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00

tree-wide: do not assign unused return values

This commit is contained in:
Yu Watanabe 2018-09-01 23:12:47 +09:00
parent 8a80712bcd
commit 2c740afd16
3 changed files with 13 additions and 25 deletions

View File

@ -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;
}

View File

@ -357,8 +357,7 @@ int main(int argc, char *argv[]) {
root_directory = true;
}
r = sd_device_get_property_value(dev, "ID_FS_TYPE", &type);
if (r >= 0) {
if (sd_device_get_property_value(dev, "ID_FS_TYPE", &type) >= 0) {
r = fsck_exists(type);
if (r < 0)
log_warning_errno(r, "Couldn't detect if fsck.%s may be used for %s, proceeding: %m", type, device);

View File

@ -39,16 +39,13 @@ static bool arg_legend = true;
static bool arg_all = false;
static char *link_get_type_string(unsigned short iftype, sd_device *d) {
const char *t;
const char *t, *devtype;
char *p;
if (d) {
const char *devtype = NULL;
(void) sd_device_get_devtype(d, &devtype);
if (!isempty(devtype))
if (d &&
sd_device_get_devtype(d, &devtype) >= 0 &&
!isempty(devtype))
return strdup(devtype);
}
t = arphrd_to_name(iftype);
if (!t)
@ -768,12 +765,10 @@ static int link_status_one(
(void) sd_device_get_property_value(d, "ID_NET_DRIVER", &driver);
(void) sd_device_get_property_value(d, "ID_PATH", &path);
r = sd_device_get_property_value(d, "ID_VENDOR_FROM_DATABASE", &vendor);
if (r < 0)
if (sd_device_get_property_value(d, "ID_VENDOR_FROM_DATABASE", &vendor) < 0)
(void) sd_device_get_property_value(d, "ID_VENDOR", &vendor);
r = sd_device_get_property_value(d, "ID_MODEL_FROM_DATABASE", &model);
if (r < 0)
if (sd_device_get_property_value(d, "ID_MODEL_FROM_DATABASE", &model) < 0)
(void) sd_device_get_property_value(d, "ID_MODEL", &model);
}