Before this change the report gave successful exit value when destination
hostname could not be found.
$ ./mtr --report nxdomain. ; echo $?
./mtr: Failed to resolve host: nxdomain.: Name or service not known
0
Quickly looking 'git grep ---after-context if.*Interactive' there does not
appear to be more than the two instances in main() where exit is called
depending on interactive, so this change should cover all these cases.
Reported-by: Marek Kroemeke <mkroemeke@cloudflare.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
int argc,
char **argv)
{
+ int exit_val = EXIT_SUCCESS;
names_t *names_head = NULL;
names_t *names_walk;
if (ctl.Interactive)
exit(EXIT_FAILURE);
else {
+ exit_val = EXIT_FAILURE;
names_walk = names_walk->next;
continue;
}
if (ctl.Interactive)
exit(EXIT_FAILURE);
else {
+ exit_val = EXIT_FAILURE;
names_walk = names_walk->next;
continue;
}
item = NULL;
}
- return 0;
+ return exit_val;
}