1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-10 05:18:17 +03:00

hostnamed: trivial optimization

This commit is contained in:
Lennart Poettering 2022-02-03 17:19:32 +01:00 committed by Luca Boccassi
parent 1d2bf1f0ee
commit e6fccf029b

View File

@ -185,15 +185,16 @@ static int get_dmi_data(const char *database_key, const char *regular_key, char
if (!s && regular_key)
(void) sd_device_get_property_value(device, regular_key, &s);
if (!ret)
return !!s;
if (s) {
b = strdup(s);
if (!b)
return -ENOMEM;
}
if (ret)
*ret = TAKE_PTR(b);
*ret = TAKE_PTR(b);
return !!s;
}