summaryrefslogtreecommitdiffstats
path: root/src/resolve/resolved-dnssd.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2024-03-19 18:27:04 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2024-03-20 15:13:44 +0100
commit454318d3e86c125a78e61a825d84db1b52c1a4a9 (patch)
treeec46d6c3506a588343a050823b796c1c828274f8 /src/resolve/resolved-dnssd.c
parenttest-cgroup-util: reduce scope of iterator variables (diff)
downloadsystemd-454318d3e86c125a78e61a825d84db1b52c1a4a9.tar.xz
systemd-454318d3e86c125a78e61a825d84db1b52c1a4a9.zip
various: use strdup_to() in various obvious cases
strdup_to() returns 0 on success and here we convert obvious blocks which either return -ENOMEM or 0.
Diffstat (limited to 'src/resolve/resolved-dnssd.c')
-rw-r--r--src/resolve/resolved-dnssd.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/resolve/resolved-dnssd.c b/src/resolve/resolved-dnssd.c
index 404c290eec..8790755d3b 100644
--- a/src/resolve/resolved-dnssd.c
+++ b/src/resolve/resolved-dnssd.c
@@ -140,16 +140,10 @@ static int dnssd_service_load(Manager *manager, const char *filename) {
static int specifier_dnssd_hostname(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
const Manager *m = ASSERT_PTR(userdata);
- char *n;
assert(m->llmnr_hostname);
- n = strdup(m->llmnr_hostname);
- if (!n)
- return -ENOMEM;
-
- *ret = n;
- return 0;
+ return strdup_to(ret, m->llmnr_hostname);
}
int dnssd_render_instance_name(Manager *m, DnssdService *s, char **ret) {