]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/resolve/resolved-dnssd.c
coccinelle: make use of SYNTHETIC_ERRNO
[thirdparty/systemd.git] / src / resolve / resolved-dnssd.c
index 02e012f4ec243a248ec638c3d719c3b2b85921d6..ea96255dc1980b79845e963ee8fdc4bd731027b1 100644 (file)
@@ -1,8 +1,3 @@
-/***
-  This file is part of systemd.
-
-  Copyright 2017 Dmitry Rozhkov
-***/
 
 #include "conf-files.h"
 #include "conf-parser.h"
@@ -16,7 +11,7 @@ const char* const dnssd_service_dirs[] = {
         "/etc/systemd/dnssd",
         "/run/systemd/dnssd",
         "/usr/lib/systemd/dnssd",
-#ifdef HAVE_SPLIT_USR
+#if HAVE_SPLIT_USR
         "/lib/systemd/dnssd",
 #endif
     NULL
@@ -166,7 +161,7 @@ int dnssd_render_instance_name(DnssdService *s, char **ret_name) {
         static const Specifier specifier_table[] = {
                 { 'b', specifier_boot_id,         NULL },
                 { 'H', specifier_dnssd_host_name, NULL },
-                { 'm', specifier_machine_id, NULL },
+                { 'm', specifier_machine_id,      NULL },
                 { 'v', specifier_kernel_release,  NULL },
                 {}
         };
@@ -180,10 +175,10 @@ int dnssd_render_instance_name(DnssdService *s, char **ret_name) {
         if (r < 0)
                 return log_debug_errno(r, "Failed to replace specifiers: %m");
 
-        if (!dns_service_name_is_valid(name)) {
-                log_debug("Service instance name '%s' is invalid.", name);
-                return -EINVAL;
-        }
+        if (!dns_service_name_is_valid(name))
+                return log_debug_errno(SYNTHETIC_ERRNO(EINVAL),
+                                       "Service instance name '%s' is invalid.",
+                                       name);
 
         *ret_name = TAKE_PTR(name);