From de292aa1dd1942e151ff034fcb88504a86742f97 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Sun, 3 Aug 2014 14:02:04 -0400 Subject: resolve-host: make arg_type an int We are using it also to store _DNS_TYPE_INVALID, so it should be signed. --- src/resolve-host/resolve-host.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/resolve-host/resolve-host.c') diff --git a/src/resolve-host/resolve-host.c b/src/resolve-host/resolve-host.c index 987b43a0cb..4b46cdfa16 100644 --- a/src/resolve-host/resolve-host.c +++ b/src/resolve-host/resolve-host.c @@ -37,7 +37,7 @@ static int arg_family = AF_UNSPEC; static int arg_ifindex = 0; -static uint16_t arg_type = 0; +static int arg_type = 0; static uint16_t arg_class = 0; static bool arg_legend = true; @@ -316,6 +316,7 @@ static int resolve_record(sd_bus *bus, const char *name) { if (r < 0) return bus_log_create_error(r); + assert((uint16_t) arg_type == arg_type); r = sd_bus_message_append(req, "sqq", name, arg_class, arg_type); if (r < 0) return bus_log_create_error(r); @@ -482,11 +483,12 @@ static int parse_argv(int argc, char *argv[]) { return 0; } - r = dns_type_from_string(optarg, &arg_type); - if (r < 0) { + arg_type = dns_type_from_string(optarg); + if (arg_type < 0) { log_error("Failed to parse RR record type %s", optarg); return r; } + assert(arg_type > 0 && (uint16_t) arg_type == arg_type); break; -- cgit v1.2.3-54-g00ecf