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);
assert(argc >= 0);
assert(argv);
- while ((c = getopt_long(argc, argv, "h46i:t:c:", options, NULL)) >= 0) {
+ while ((c = getopt_long(argc, argv, "h46i:t:c:", options, NULL)) >= 0)
switch(c) {
case 'h':
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;
default:
assert_not_reached("Unhandled option");
}
- }
if (arg_type == 0 && arg_class != 0) {
log_error("--class= may only be used in conjunction with --type=");
}
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();