From: Yu Watanabe Date: Tue, 18 Oct 2022 11:27:41 +0000 (+0900) Subject: resolvectl: rely on invoked_as() X-Git-Tag: v252-rc3~1^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=427eeb44f229c8613b0f3d7f06bf4eff6c55a00f;p=thirdparty%2Fsystemd.git resolvectl: rely on invoked_as() --- diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c index 9341fb0435a..25ba1291187 100644 --- a/src/resolve/resolvectl.c +++ b/src/resolve/resolvectl.c @@ -3599,16 +3599,19 @@ static int compat_main(int argc, char *argv[], sd_bus *bus) { static int run(int argc, char **argv) { _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL; + bool compat = false; int r; setlocale(LC_ALL, ""); log_setup(); - if (invoked_as(argv, "resolvconf")) + if (invoked_as(argv, "resolvconf")) { + compat = true; r = resolvconf_parse_argv(argc, argv); - else if (invoked_as(argv, "systemd-resolve")) + } else if (invoked_as(argv, "systemd-resolve")) { + compat = true; r = compat_parse_argv(argc, argv); - else + } else r = native_parse_argv(argc, argv); if (r <= 0) return r; @@ -3617,7 +3620,7 @@ static int run(int argc, char **argv) { if (r < 0) return log_error_errno(r, "sd_bus_open_system: %m"); - if (STR_IN_SET(program_invocation_short_name, "systemd-resolve", "resolvconf")) + if (compat) return compat_main(argc, argv, bus); return native_main(argc, argv, bus);