]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/resolve/resolvconf-compat.c
Merge pull request #11827 from keszybz/pkgconfig-variables
[thirdparty/systemd.git] / src / resolve / resolvconf-compat.c
index 013b215a808e400e395b6428fc70673ed3282409..383d0b819bdb08e7f017ce8277d72128950d873a 100644 (file)
@@ -9,6 +9,7 @@
 #include "extract-word.h"
 #include "fileio.h"
 #include "parse-util.h"
+#include "pretty-print.h"
 #include "resolvconf-compat.h"
 #include "resolvectl.h"
 #include "resolved-def.h"
@@ -182,19 +183,19 @@ int resolvconf_parse_argv(int argc, char *argv[]) {
                 case 'r':
                 case 'v':
                 case 'V':
-                        log_error("Switch -%c not supported.", c);
-                        return -EINVAL;
+                        return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+                                               "Switch -%c not supported.", c);
 
                 /* The Debian resolvconf commands we don't support. */
                 case ARG_ENABLE_UPDATES:
-                        log_error("Switch --enable-updates not supported.");
-                        return -EINVAL;
+                        return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+                                               "Switch --enable-updates not supported.");
                 case ARG_DISABLE_UPDATES:
-                        log_error("Switch --disable-updates not supported.");
-                        return -EINVAL;
+                        return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+                                               "Switch --disable-updates not supported.");
                 case ARG_UPDATES_ARE_ENABLED:
-                        log_error("Switch --updates-are-enabled not supported.");
-                        return -EINVAL;
+                        return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+                                               "Switch --updates-are-enabled not supported.");
 
                 case '?':
                         return -EINVAL;
@@ -203,17 +204,15 @@ int resolvconf_parse_argv(int argc, char *argv[]) {
                         assert_not_reached("Unhandled option");
                 }
 
-        if (arg_mode == _MODE_INVALID) {
-                log_error("Expected either -a or -d on the command line.");
-                return -EINVAL;
-        }
+        if (arg_mode == _MODE_INVALID)
+                return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+                                       "Expected either -a or -d on the command line.");
 
-        if (optind+1 != argc) {
-                log_error("Expected interface name as argument.");
-                return -EINVAL;
-        }
+        if (optind+1 != argc)
+                return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+                                       "Expected interface name as argument.");
 
-        r = ifname_mangle(argv[optind], false);
+        r = ifname_mangle(argv[optind]);
         if (r <= 0)
                 return r;
 
@@ -267,10 +266,9 @@ int resolvconf_parse_argv(int argc, char *argv[]) {
                 } else if (type == TYPE_PRIVATE)
                         log_debug("Private DNS server data not supported, ignoring.");
 
-                if (!arg_set_dns) {
-                        log_error("No DNS servers specified, refusing operation.");
-                        return -EINVAL;
-                }
+                if (!arg_set_dns)
+                        return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+                                               "No DNS servers specified, refusing operation.");
         }
 
         return 1; /* work to do */