diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-12-18 13:57:01 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-01-11 12:07:28 +0100 |
commit | 9030b50a7bfe081f17d03f51c615def8485e937a (patch) | |
tree | 2204e901b96dbf4be56038e8a5bef5bf3b08d589 /src | |
parent | tree-wide: make parse_ifindex simply return the index (diff) | |
download | systemd-9030b50a7bfe081f17d03f51c615def8485e937a.tar.xz systemd-9030b50a7bfe081f17d03f51c615def8485e937a.zip |
timedatectl: drop ifindex output parameter too
Diffstat (limited to 'src')
-rw-r--r-- | src/timedate/timedatectl.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c index d51e29de1e..7d0201e6ff 100644 --- a/src/timedate/timedatectl.c +++ b/src/timedate/timedatectl.c @@ -829,7 +829,7 @@ static int show_timesync(int argc, char **argv, void *userdata) { return 0; } -static int parse_ifindex_bus(sd_bus *bus, const char *str, int *ret) { +static int parse_ifindex_bus(sd_bus *bus, const char *str) { _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; int32_t i; @@ -837,14 +837,11 @@ static int parse_ifindex_bus(sd_bus *bus, const char *str, int *ret) { assert(bus); assert(str); - assert(ret); r = parse_ifindex(str); - if (r >= 0) { - assert(r != 0); - *ret = r; - return 0; - } + if (r > 0) + return r; + assert(r < 0); r = sd_bus_call_method( bus, @@ -862,8 +859,7 @@ static int parse_ifindex_bus(sd_bus *bus, const char *str, int *ret) { if (r < 0) return bus_log_create_error(r); - *ret = i; - return 0; + return i; } static int verb_ntp_servers(int argc, char **argv, void *userdata) { @@ -874,9 +870,9 @@ static int verb_ntp_servers(int argc, char **argv, void *userdata) { assert(bus); - r = parse_ifindex_bus(bus, argv[1], &ifindex); - if (r < 0) - return r; + ifindex = parse_ifindex_bus(bus, argv[1]); + if (ifindex < 0) + return ifindex; polkit_agent_open_if_enabled(arg_transport, arg_ask_password); @@ -912,9 +908,9 @@ static int verb_revert(int argc, char **argv, void *userdata) { assert(bus); - r = parse_ifindex_bus(bus, argv[1], &ifindex); - if (r < 0) - return r; + ifindex = parse_ifindex_bus(bus, argv[1]); + if (ifindex < 0) + return ifindex; polkit_agent_open_if_enabled(arg_transport, arg_ask_password); |