diff options
author | Lennart Poettering <lennart@poettering.net> | 2022-02-03 17:19:32 +0100 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2022-02-03 23:51:51 +0100 |
commit | e6fccf029bfae133c9158304af66dc28e0399549 (patch) | |
tree | a5b07eaf5f2ee6b8e54ffd7eb7e169aee7944dd9 /src/hostname/hostnamed.c | |
parent | portable: reopen socket with O_RDONLY (diff) | |
download | systemd-e6fccf029bfae133c9158304af66dc28e0399549.tar.xz systemd-e6fccf029bfae133c9158304af66dc28e0399549.zip |
hostnamed: trivial optimization
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; } |