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;
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);
" -i INTERFACE Filter by interface\n"
" -t --type=TYPE Query RR with DNS type\n"
" -c --class=CLASS Query RR with DNS class\n"
- " --no-legend Do not print column headers\n"
+ " --no-legend Do not print column headers\n"
, program_invocation_short_name);
}
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;
+ return arg_type;
}
+ assert(arg_type > 0 && (uint16_t) arg_type == arg_type);
break;
}
int main(int argc, char **argv) {
- _cleanup_bus_unref_ sd_bus *bus = NULL;
+ _cleanup_bus_close_unref_ sd_bus *bus = NULL;
int r;
log_parse_environment();