smartdns: Fixe coredump issue caused by running smartdns --help
This commit is contained in:
@@ -765,7 +765,8 @@ int main(int argc, char *argv[])
|
|||||||
sigset_t empty_sigblock;
|
sigset_t empty_sigblock;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
static struct option long_options[] = {{"cache-print", required_argument, 0, 256}};
|
static struct option long_options[] = {
|
||||||
|
{"cache-print", required_argument, 0, 256}, {"help", no_argument, 0, 'h'}, {NULL, 0, 0, 0}};
|
||||||
|
|
||||||
safe_strncpy(config_file, SMARTDNS_CONF_FILE, MAX_LINE_LEN);
|
safe_strncpy(config_file, SMARTDNS_CONF_FILE, MAX_LINE_LEN);
|
||||||
|
|
||||||
@@ -811,9 +812,13 @@ int main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
case 'h':
|
case 'h':
|
||||||
_help();
|
_help();
|
||||||
return 1;
|
return 0;
|
||||||
case 256:
|
case 256:
|
||||||
return dns_cache_print(optarg);
|
return dns_cache_print(optarg);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "unknown option, please run %s -h for help.\n", argv[0]);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user