diff options
Diffstat (limited to 'src/hostname/hostnamed.c')
-rw-r--r-- | src/hostname/hostnamed.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index a60e0f8295..0a922ec494 100644 --- a/src/hostname/hostnamed.c +++ b/src/hostname/hostnamed.c @@ -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; } |