2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-22 18:19:42 +00:00

Use EXIT_SUCCESS and EXIT_FAILURE

Instead of randomly using -1 or 1 as a failure status, properly utilize
the EXIT_FAILURE define that's platform specific (as it should be).
This commit is contained in:
Ondřej Surý 2024-02-07 14:50:38 +01:00
parent e140743e6a
commit 76997983fd
No known key found for this signature in database
GPG Key ID: 2820F37E873DEA41
41 changed files with 153 additions and 150 deletions

View File

@ -63,7 +63,7 @@ usage(void) {
"usage: %s [-achijlvz] [-p [-x]] [-t directory] " "usage: %s [-achijlvz] [-p [-x]] [-t directory] "
"[named.conf]\n", "[named.conf]\n",
program); program);
exit(1); exit(EXIT_SUCCESS);
} }
/*% directory callback */ /*% directory callback */

View File

@ -350,7 +350,7 @@ main(int argc, char **argv) {
case 'v': case 'v':
printf("%s\n", PACKAGE_VERSION); printf("%s\n", PACKAGE_VERSION);
exit(0); exit(EXIT_SUCCESS);
case 'w': case 'w':
workdir = isc_commandline_argument; workdir = isc_commandline_argument;

View File

@ -146,7 +146,8 @@ main(int argc, char **argv) {
keyfile = isc_commandline_argument; keyfile = isc_commandline_argument;
break; break;
case 'h': case 'h':
usage(0); usage(EXIT_SUCCESS);
break;
case 'k': case 'k':
case 'y': /* Compatible with rndc -y. */ case 'y': /* Compatible with rndc -y. */
keyname = isc_commandline_argument; keyname = isc_commandline_argument;
@ -192,15 +193,15 @@ main(int argc, char **argv) {
if (isc_commandline_option != '?') { if (isc_commandline_option != '?') {
fprintf(stderr, "%s: invalid argument -%c\n", fprintf(stderr, "%s: invalid argument -%c\n",
program, isc_commandline_option); program, isc_commandline_option);
usage(1); usage(EXIT_FAILURE);
} else { } else {
usage(0); usage(EXIT_SUCCESS);
} }
break; break;
default: default:
fprintf(stderr, "%s: unhandled option -%c\n", program, fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option); isc_commandline_option);
exit(1); exit(EXIT_FAILURE);
} }
} }
@ -209,7 +210,7 @@ main(int argc, char **argv) {
POST(argv); POST(argv);
if (argc > 0) { if (argc > 0) {
usage(1); usage(EXIT_FAILURE);
} }
if (alg == DST_ALG_HMACMD5) { if (alg == DST_ALG_HMACMD5) {

View File

@ -138,13 +138,13 @@ main(int argc, char **argv) {
keysize = alg_bits(alg); keysize = alg_bits(alg);
break; break;
case 'h': case 'h':
usage(0); usage(EXIT_SUCCESS);
case 'k': case 'k':
case 'y': case 'y':
if (progmode == progmode_confgen) { if (progmode == progmode_confgen) {
keyname = isc_commandline_argument; keyname = isc_commandline_argument;
} else { } else {
usage(1); usage(EXIT_FAILURE);
} }
break; break;
case 'M': case 'M':
@ -157,7 +157,7 @@ main(int argc, char **argv) {
if (progmode == progmode_confgen) { if (progmode == progmode_confgen) {
quiet = true; quiet = true;
} else { } else {
usage(1); usage(EXIT_FAILURE);
} }
break; break;
case 'r': case 'r':
@ -167,29 +167,29 @@ main(int argc, char **argv) {
if (progmode == progmode_confgen) { if (progmode == progmode_confgen) {
self_domain = isc_commandline_argument; self_domain = isc_commandline_argument;
} else { } else {
usage(1); usage(EXIT_FAILURE);
} }
break; break;
case 'z': case 'z':
if (progmode == progmode_confgen) { if (progmode == progmode_confgen) {
zone = isc_commandline_argument; zone = isc_commandline_argument;
} else { } else {
usage(1); usage(EXIT_FAILURE);
} }
break; break;
case '?': case '?':
if (isc_commandline_option != '?') { if (isc_commandline_option != '?') {
fprintf(stderr, "%s: invalid argument -%c\n", fprintf(stderr, "%s: invalid argument -%c\n",
program, isc_commandline_option); program, isc_commandline_option);
usage(1); usage(EXIT_FAILURE);
} else { } else {
usage(0); usage(EXIT_SUCCESS);
} }
break; break;
default: default:
fprintf(stderr, "%s: unhandled option -%c\n", program, fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option); isc_commandline_option);
exit(1); exit(EXIT_FAILURE);
} }
} }
@ -200,11 +200,11 @@ main(int argc, char **argv) {
POST(argv); POST(argv);
if (self_domain != NULL && zone != NULL) { if (self_domain != NULL && zone != NULL) {
usage(1); /* -s and -z cannot coexist */ usage(EXIT_FAILURE); /* -s and -z cannot coexist */
} }
if (argc > isc_commandline_index) { if (argc > isc_commandline_index) {
usage(1); usage(EXIT_FAILURE);
} }
/* Use canonical algorithm name */ /* Use canonical algorithm name */

View File

@ -247,7 +247,7 @@ usage(void) {
"process)\n" "process)\n"
" +[no]yaml (Present the results as " " +[no]yaml (Present the results as "
"YAML)\n"); "YAML)\n");
exit(1); exit(EXIT_FAILURE);
} }
noreturn static void noreturn static void
@ -1163,7 +1163,7 @@ plus_option(char *option) {
if (state) { if (state) {
fprintf(stderr, "Invalid option: " fprintf(stderr, "Invalid option: "
"+dlv is obsolete\n"); "+dlv is obsolete\n");
exit(1); exit(EXIT_FAILURE);
} }
break; break;
case 'n': /* dnssec */ case 'n': /* dnssec */
@ -1430,7 +1430,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
break; break;
case 'h': case 'h':
usage(); usage();
exit(0); exit(EXIT_SUCCESS);
case 'i': case 'i':
no_sigs = true; no_sigs = true;
root_validation = false; root_validation = false;
@ -1440,7 +1440,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
break; break;
case 'v': case 'v':
printf("delv %s\n", PACKAGE_VERSION); printf("delv %s\n", PACKAGE_VERSION);
exit(0); exit(EXIT_SUCCESS);
default: default:
UNREACHABLE(); UNREACHABLE();
} }
@ -1577,7 +1577,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
typeset = true; typeset = true;
} else { } else {
fprintf(stderr, "Invalid IP address %s\n", value); fprintf(stderr, "Invalid IP address %s\n", value);
exit(1); exit(EXIT_FAILURE);
} }
return (value_from_next); return (value_from_next);
invalid_option: invalid_option:

View File

@ -119,7 +119,7 @@ usage(void) {
print_usage(stderr); print_usage(stderr);
fprintf(stderr, "\nUse \"dig -h\" (or \"dig -h | more\") " fprintf(stderr, "\nUse \"dig -h\" (or \"dig -h | more\") "
"for complete list of options\n"); "for complete list of options\n");
exit(1); exit(EXIT_FAILURE);
} }
#endif /* if TARGET_OS_IPHONE */ #endif /* if TARGET_OS_IPHONE */
@ -2624,7 +2624,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
break; break;
case 'h': case 'h':
help(); help();
exit(0); exit(EXIT_SUCCESS);
break; break;
case 'i': case 'i':
fatal("-%c removed", option[0]); fatal("-%c removed", option[0]);
@ -2642,7 +2642,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
break; break;
case 'v': case 'v':
printf("DiG %s\n", PACKAGE_VERSION); printf("DiG %s\n", PACKAGE_VERSION);
exit(0); exit(EXIT_SUCCESS);
break; break;
} }
if (strlen(option) > 1U) { if (strlen(option) > 1U) {
@ -2851,7 +2851,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
ISC_LIST_APPEND(lookup_list, *lookup, link); ISC_LIST_APPEND(lookup_list, *lookup, link);
} else { } else {
fprintf(stderr, "Invalid IP address %s\n", value); fprintf(stderr, "Invalid IP address %s\n", value);
exit(1); exit(EXIT_FAILURE);
} }
return (value_from_next); return (value_from_next);
invalid_option: invalid_option:

View File

@ -132,7 +132,7 @@ show_usage(void) {
" -W specifies how long to wait for a reply\n" " -W specifies how long to wait for a reply\n"
" -4 use IPv4 query transport only\n" " -4 use IPv4 query transport only\n"
" -6 use IPv6 query transport only\n"); " -6 use IPv6 query transport only\n");
exit(1); exit(EXIT_FAILURE);
} }
static void static void
@ -654,7 +654,7 @@ pre_parse_args(int argc, char **argv) {
break; break;
case 'V': case 'V':
printf("host %s\n", PACKAGE_VERSION); printf("host %s\n", PACKAGE_VERSION);
exit(0); exit(EXIT_SUCCESS);
break; break;
case 'w': case 'w':
break; break;

View File

@ -849,7 +849,7 @@ usage(void) {
"'host' using default server\n"); "'host' using default server\n");
fprintf(stderr, " nslookup [-opt ...] host server # just look up " fprintf(stderr, " nslookup [-opt ...] host server # just look up "
"'host' using 'server'\n"); "'host' using 'server'\n");
exit(1); exit(EXIT_FAILURE);
} }
static void static void
@ -862,7 +862,7 @@ parse_args(int argc, char **argv) {
if (argv[0][0] == '-') { if (argv[0][0] == '-') {
if (strncasecmp(argv[0], "-ver", 4) == 0) { if (strncasecmp(argv[0], "-ver", 4) == 0) {
printf("nslookup %s\n", PACKAGE_VERSION); printf("nslookup %s\n", PACKAGE_VERSION);
exit(0); exit(EXIT_SUCCESS);
} else if (argv[0][1] != 0) { } else if (argv[0][1] != 0) {
setoption(&argv[0][1]); setoption(&argv[0][1]);
} else { } else {

View File

@ -1056,7 +1056,7 @@ usage(void) {
" -T <ttl> TTL of DS records\n" " -T <ttl> TTL of DS records\n"
" -V print version\n" " -V print version\n"
" -v <verbosity>\n"); " -v <verbosity>\n");
exit(1); exit(EXIT_FAILURE);
} }
static void static void
@ -1354,5 +1354,6 @@ main(int argc, char *argv[]) {
cleanup: cleanup:
print_mem_stats = true; print_mem_stats = true;
cleanup(); cleanup();
exit(0);
return (0);
} }

View File

@ -353,7 +353,7 @@ usage(void) {
" -V: print version information\n"); " -V: print version information\n");
fprintf(stderr, "Output: DS or CDS RRs\n"); fprintf(stderr, "Output: DS or CDS RRs\n");
exit(-1); exit(EXIT_FAILURE);
} }
int int
@ -452,7 +452,7 @@ main(int argc, char **argv) {
default: default:
fprintf(stderr, "%s: unhandled option -%c\n", program, fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option); isc_commandline_option);
exit(1); exit(EXIT_FAILURE);
} }
} }

View File

@ -289,7 +289,7 @@ usage(void) {
fprintf(stderr, " -D sync date/[+-]offset/none: set/unset " fprintf(stderr, " -D sync date/[+-]offset/none: set/unset "
"CDS and CDNSKEY deletion date\n"); "CDS and CDNSKEY deletion date\n");
exit(-1); exit(EXIT_FAILURE);
} }
int int
@ -395,7 +395,7 @@ main(int argc, char **argv) {
default: default:
fprintf(stderr, "%s: unhandled option -%c\n", program, fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option); isc_commandline_option);
exit(1); exit(EXIT_FAILURE);
} }
} }

View File

@ -102,7 +102,7 @@ usage(void) {
fprintf(stderr, " K<name>+<alg>+<id>.key, " fprintf(stderr, " K<name>+<alg>+<id>.key, "
"K<name>+<alg>+<id>.private\n"); "K<name>+<alg>+<id>.private\n");
exit(-1); exit(EXIT_FAILURE);
} }
int int
@ -331,7 +331,7 @@ main(int argc, char **argv) {
default: default:
fprintf(stderr, "%s: unhandled option -%c\n", program, fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option); isc_commandline_option);
exit(1); exit(EXIT_FAILURE);
} }
} }
@ -606,7 +606,7 @@ main(int argc, char **argv) {
fatal("failed to get key %s/%s: %s", namestr, algstr, fatal("failed to get key %s/%s: %s", namestr, algstr,
isc_result_totext(ret)); isc_result_totext(ret));
UNREACHABLE(); UNREACHABLE();
exit(-1); exit(EXIT_FAILURE);
} }
/* /*

View File

@ -227,7 +227,7 @@ usage(void) {
fprintf(stderr, " K<name>+<alg>+<id>.key, " fprintf(stderr, " K<name>+<alg>+<id>.key, "
"K<name>+<alg>+<id>.private\n"); "K<name>+<alg>+<id>.private\n");
exit(-1); exit(EXIT_FAILURE);
} }
static void static void
@ -1196,7 +1196,7 @@ main(int argc, char **argv) {
default: default:
fprintf(stderr, "%s: unhandled option -%c\n", program, fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option); isc_commandline_option);
exit(1); exit(EXIT_FAILURE);
} }
} }

View File

@ -58,7 +58,7 @@ usage(void) {
fprintf(stderr, " K<name>+<alg>+<new id>.key, " fprintf(stderr, " K<name>+<alg>+<new id>.key, "
"K<name>+<alg>+<new id>.private\n"); "K<name>+<alg>+<new id>.private\n");
exit(-1); exit(EXIT_FAILURE);
} }
int int
@ -130,7 +130,7 @@ main(int argc, char **argv) {
default: default:
fprintf(stderr, "%s: unhandled option -%c\n", program, fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option); isc_commandline_option);
exit(1); exit(EXIT_FAILURE);
} }
} }

View File

@ -101,7 +101,7 @@ usage(void) {
fprintf(stderr, " K<name>+<alg>+<new id>.key, " fprintf(stderr, " K<name>+<alg>+<new id>.key, "
"K<name>+<alg>+<new id>.private\n"); "K<name>+<alg>+<new id>.private\n");
exit(-1); exit(EXIT_FAILURE);
} }
static void static void
@ -536,7 +536,7 @@ main(int argc, char **argv) {
default: default:
fprintf(stderr, "%s: unhandled option -%c\n", program, fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option); isc_commandline_option);
exit(1); exit(EXIT_FAILURE);
} }
} }

View File

@ -3300,7 +3300,7 @@ usage(void) {
fprintf(stderr, "(default: all zone keys that have private keys)\n"); fprintf(stderr, "(default: all zone keys that have private keys)\n");
fprintf(stderr, "\tkeyfile (Kname+alg+tag)\n"); fprintf(stderr, "\tkeyfile (Kname+alg+tag)\n");
exit(0); exit(EXIT_FAILURE);
} }
static void static void
@ -3550,7 +3550,7 @@ main(int argc, char *argv[]) {
if (*endp != '\0') { if (*endp != '\0') {
fprintf(stderr, "source serial number " fprintf(stderr, "source serial number "
"must be numeric"); "must be numeric");
exit(1); exit(EXIT_FAILURE);
} }
break; break;
@ -3565,7 +3565,7 @@ main(int argc, char *argv[]) {
if (*endp != '\0') { if (*endp != '\0') {
fprintf(stderr, "maximum TTL " fprintf(stderr, "maximum TTL "
"must be numeric"); "must be numeric");
exit(1); exit(EXIT_FAILURE);
} }
break; break;
@ -3689,7 +3689,7 @@ main(int argc, char *argv[]) {
default: default:
fprintf(stderr, "%s: unhandled option -%c\n", program, fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option); isc_commandline_option);
exit(1); exit(EXIT_FAILURE);
} }
} }
@ -3818,7 +3818,7 @@ main(int argc, char *argv[]) {
rawversion > 1U) rawversion > 1U)
{ {
fprintf(stderr, "unknown raw format version\n"); fprintf(stderr, "unknown raw format version\n");
exit(1); exit(EXIT_FAILURE);
} }
} else { } else {
fatal("unknown file format: %s", outputformatstr); fatal("unknown file format: %s", outputformatstr);

View File

@ -162,7 +162,7 @@ usage(void) {
fprintf(stderr, "\t-x:\tDNSKEY record signed with KSKs only, " fprintf(stderr, "\t-x:\tDNSKEY record signed with KSKs only, "
"not ZSKs\n"); "not ZSKs\n");
fprintf(stderr, "\t-z:\tAll records signed with KSKs\n"); fprintf(stderr, "\t-z:\tAll records signed with KSKs\n");
exit(0); exit(EXIT_SUCCESS);
} }
int int
@ -271,7 +271,7 @@ main(int argc, char *argv[]) {
default: default:
fprintf(stderr, "%s: unhandled option -%c\n", program, fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option); isc_commandline_option);
exit(1); exit(EXIT_FAILURE);
} }
} }

View File

@ -117,7 +117,7 @@ vbprintf(int level, const char *fmt, ...) {
void void
version(const char *name) { version(const char *name) {
printf("%s %s\n", name, PACKAGE_VERSION); printf("%s %s\n", name, PACKAGE_VERSION);
exit(0); exit(EXIT_SUCCESS);
} }
void void

View File

@ -892,7 +892,7 @@ parse_command_line(int argc, char *argv[]) {
printf("# Built-in default values. " printf("# Built-in default values. "
"This is NOT the run-time configuration!\n"); "This is NOT the run-time configuration!\n");
printf("%s", named_config_getdefault()); printf("%s", named_config_getdefault());
exit(0); exit(EXIT_SUCCESS);
case 'd': case 'd':
named_g_debuglevel = parse_int(isc_commandline_argument, named_g_debuglevel = parse_int(isc_commandline_argument,
"debug " "debug "
@ -955,10 +955,10 @@ parse_command_line(int argc, char *argv[]) {
break; break;
case 'v': case 'v':
printversion(false); printversion(false);
exit(0); exit(EXIT_SUCCESS);
case 'V': case 'V':
printversion(true); printversion(true);
exit(0); exit(EXIT_SUCCESS);
case 'x': case 'x':
/* Obsolete. No longer in use. Ignore. */ /* Obsolete. No longer in use. Ignore. */
break; break;
@ -993,7 +993,7 @@ parse_command_line(int argc, char *argv[]) {
case '?': case '?':
usage(); usage();
if (isc_commandline_option == '?') { if (isc_commandline_option == '?') {
exit(0); exit(EXIT_SUCCESS);
} }
p = strchr(NAMED_MAIN_ARGS, isc_commandline_option); p = strchr(NAMED_MAIN_ARGS, isc_commandline_option);
if (p == NULL || *++p != ':') { if (p == NULL || *++p != ':') {

View File

@ -428,10 +428,10 @@ named_os_daemonize(void) {
char buf; char buf;
n = read(dfd[0], &buf, 1); n = read(dfd[0], &buf, 1);
if (n == 1) { if (n == 1) {
_exit(0); _exit(EXIT_SUCCESS);
} }
} while (n == -1 && errno == EINTR); } while (n == -1 && errno == EINTR);
_exit(1); _exit(EXIT_FAILURE);
} }
(void)close(dfd[0]); (void)close(dfd[0]);

View File

@ -513,7 +513,7 @@ setup_keystr(void) {
name = secretstr; name = secretstr;
secretstr = n + 1; secretstr = n + 1;
if (!parse_hmac(keystr, s - keystr, &hmac_alg, &digestbits)) { if (!parse_hmac(keystr, s - keystr, &hmac_alg, &digestbits)) {
exit(1); exit(EXIT_FAILURE);
} }
} else { } else {
hmac_alg = DST_ALG_HMACMD5; hmac_alg = DST_ALG_HMACMD5;
@ -1054,7 +1054,7 @@ pre_parse_args(int argc, char **argv) {
"[-A tlscafile] [-H tlshostname] " "[-A tlscafile] [-H tlshostname] "
"[-O] ] [-v] [-V] [-P] [-T] [-4 | -6] " "[-O] ] [-v] [-V] [-P] [-T] [-4 | -6] "
"[filename]\n"); "[filename]\n");
exit(1); exit(EXIT_FAILURE);
case 'P': case 'P':
for (t = 0xff00; t <= 0xfffe; t++) { for (t = 0xff00; t <= 0xfffe; t++) {
@ -1092,7 +1092,7 @@ pre_parse_args(int argc, char **argv) {
} }
} }
if (doexit) { if (doexit) {
exit(0); exit(EXIT_SUCCESS);
} }
isc_commandline_reset = true; isc_commandline_reset = true;
isc_commandline_index = 1; isc_commandline_index = 1;
@ -1167,7 +1167,7 @@ parse_args(int argc, char **argv) {
"bad library debug value " "bad library debug value "
"'%s'\n", "'%s'\n",
isc_commandline_argument); isc_commandline_argument);
exit(1); exit(EXIT_FAILURE);
} }
logdebuglevel = i; logdebuglevel = i;
break; break;
@ -1198,7 +1198,7 @@ parse_args(int argc, char **argv) {
"bad port number " "bad port number "
"'%s'\n", "'%s'\n",
isc_commandline_argument); isc_commandline_argument);
exit(1); exit(EXIT_FAILURE);
} }
break; break;
case 'S': case 'S':
@ -1210,7 +1210,7 @@ parse_args(int argc, char **argv) {
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
fprintf(stderr, "bad timeout '%s'\n", fprintf(stderr, "bad timeout '%s'\n",
isc_commandline_argument); isc_commandline_argument);
exit(1); exit(EXIT_FAILURE);
} }
if (timeout == 0) { if (timeout == 0) {
timeout = UINT_MAX; timeout = UINT_MAX;
@ -1222,7 +1222,7 @@ parse_args(int argc, char **argv) {
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
fprintf(stderr, "bad udp timeout '%s'\n", fprintf(stderr, "bad udp timeout '%s'\n",
isc_commandline_argument); isc_commandline_argument);
exit(1); exit(EXIT_FAILURE);
} }
break; break;
case 'r': case 'r':
@ -1231,7 +1231,7 @@ parse_args(int argc, char **argv) {
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
fprintf(stderr, "bad udp retries '%s'\n", fprintf(stderr, "bad udp retries '%s'\n",
isc_commandline_argument); isc_commandline_argument);
exit(1); exit(EXIT_FAILURE);
} }
break; break;
@ -1242,19 +1242,19 @@ parse_args(int argc, char **argv) {
default: default:
fprintf(stderr, "%s: unhandled option: %c\n", argv[0], fprintf(stderr, "%s: unhandled option: %c\n", argv[0],
isc_commandline_option); isc_commandline_option);
exit(1); exit(EXIT_FAILURE);
} }
} }
if (keyfile != NULL && keystr != NULL) { if (keyfile != NULL && keystr != NULL) {
fprintf(stderr, "%s: cannot specify both -k and -y\n", argv[0]); fprintf(stderr, "%s: cannot specify both -k and -y\n", argv[0]);
exit(1); exit(EXIT_FAILURE);
} }
#if HAVE_GSSAPI #if HAVE_GSSAPI
if (usegsstsig && (keyfile != NULL || keystr != NULL)) { if (usegsstsig && (keyfile != NULL || keystr != NULL)) {
fprintf(stderr, "%s: cannot specify -g with -k or -y\n", fprintf(stderr, "%s: cannot specify -g with -k or -y\n",
argv[0]); argv[0]);
exit(1); exit(EXIT_FAILURE);
} }
#else /* HAVE_GSSAPI */ #else /* HAVE_GSSAPI */
if (usegsstsig) { if (usegsstsig) {
@ -1262,7 +1262,7 @@ parse_args(int argc, char **argv) {
"%s: cannot specify -g or -o, " "%s: cannot specify -g or -o, "
"program not linked with GSS API Library\n", "program not linked with GSS API Library\n",
argv[0]); argv[0]);
exit(1); exit(EXIT_FAILURE);
} }
#endif /* HAVE_GSSAPI */ #endif /* HAVE_GSSAPI */
@ -1275,14 +1275,14 @@ parse_args(int argc, char **argv) {
"%s: cannot specify the -K option without" "%s: cannot specify the -K option without"
"the -E option, and vice versa.\n", "the -E option, and vice versa.\n",
argv[0]); argv[0]);
exit(1); exit(EXIT_FAILURE);
} }
if (tls_ca_file != NULL && tls_always_verify_remote == false) { if (tls_ca_file != NULL && tls_always_verify_remote == false) {
fprintf(stderr, fprintf(stderr,
"%s: cannot specify the -A option in " "%s: cannot specify the -A option in "
"conjuction with the -O option.\n", "conjuction with the -O option.\n",
argv[0]); argv[0]);
exit(1); exit(EXIT_FAILURE);
} }
} }
@ -1296,7 +1296,7 @@ parse_args(int argc, char **argv) {
fprintf(stderr, "could not open '%s': %s\n", fprintf(stderr, "could not open '%s': %s\n",
argv[isc_commandline_index], argv[isc_commandline_index],
isc_result_totext(result)); isc_result_totext(result));
exit(1); exit(EXIT_FAILURE);
} }
} }
if (!force_interactive) { if (!force_interactive) {
@ -2247,7 +2247,7 @@ show_message(FILE *stream, dns_message_t *msg, const char *description) {
if (bufsz > MAXTEXT) { if (bufsz > MAXTEXT) {
fprintf(stderr, "could not allocate large enough " fprintf(stderr, "could not allocate large enough "
"buffer to display message\n"); "buffer to display message\n");
exit(1); exit(EXIT_FAILURE);
} }
if (buf != NULL) { if (buf != NULL) {
isc_buffer_free(&buf); isc_buffer_free(&buf);
@ -3577,7 +3577,7 @@ main(int argc, char **argv) {
if (seenerror) { if (seenerror) {
return (2); return (2);
} else {
return (0);
} }
return (0);
} }

View File

@ -932,7 +932,7 @@ main(int argc, char **argv) {
default: default:
fprintf(stderr, "%s: unhandled option -%c\n", program, fprintf(stderr, "%s: unhandled option -%c\n", program,
isc_commandline_option); isc_commandline_option);
exit(1); exit(EXIT_FAILURE);
} }
} }

View File

@ -46,7 +46,7 @@
if ((x) != ISC_R_SUCCESS) { \ if ((x) != ISC_R_SUCCESS) { \
fprintf(stderr, "I:%s: %s\n", (str), \ fprintf(stderr, "I:%s: %s\n", (str), \
isc_result_totext(x)); \ isc_result_totext(x)); \
exit(-1); \ exit(EXIT_FAILURE); \
} \ } \
} }
@ -76,7 +76,7 @@ recvresponse(void *arg) {
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
fprintf(stderr, "I:request event result: %s\n", fprintf(stderr, "I:request event result: %s\n",
isc_result_totext(result)); isc_result_totext(result));
exit(-1); exit(EXIT_FAILURE);
} }
dns_message_create(mctx, NULL, NULL, DNS_MESSAGE_INTENTPARSE, dns_message_create(mctx, NULL, NULL, DNS_MESSAGE_INTENTPARSE,
@ -90,7 +90,7 @@ recvresponse(void *arg) {
result = dns_result_fromrcode(response->rcode); result = dns_result_fromrcode(response->rcode);
fprintf(stderr, "I:response rcode: %s\n", fprintf(stderr, "I:response rcode: %s\n",
isc_result_totext(result)); isc_result_totext(result));
exit(-1); exit(EXIT_FAILURE);
} }
if (response->counts[DNS_SECTION_ANSWER] != 1U) { if (response->counts[DNS_SECTION_ANSWER] != 1U) {
fprintf(stderr, "I:response answer count (%u!=1)\n", fprintf(stderr, "I:response answer count (%u!=1)\n",
@ -234,7 +234,7 @@ main(int argc, char *argv[]) {
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
fprintf(stderr, "bad port '%s'\n", fprintf(stderr, "bad port '%s'\n",
isc_commandline_argument); isc_commandline_argument);
exit(1); exit(EXIT_FAILURE);
} }
break; break;
case 'r': case 'r':

View File

@ -12,7 +12,7 @@
*/ */
/* /*
* -a exit(0) if dnsrps is available or dlopen() msg if not * -a exit(EXIT_SUCCESS) if dnsrps is available or dlopen() msg if not
* -n domain print the serial number of a domain to check if a new * -n domain print the serial number of a domain to check if a new
* version of a policy zone is ready. * version of a policy zone is ready.
* Exit(1) if dnsrps is not available * Exit(1) if dnsrps is not available

View File

@ -67,7 +67,7 @@ EVP_PKEY *pkey;
msg, isc_result_totext(result), __FILE__, \ msg, isc_result_totext(result), __FILE__, \
__LINE__); \ __LINE__); \
ERR_clear_error(); \ ERR_clear_error(); \
exit(1); \ exit(EXIT_FAILURE); \
} \ } \
} while (0) } while (0)
@ -85,7 +85,7 @@ main(int argc, char **argv) {
{ {
fprintf(stderr, "fatal error: basic OpenSSL failure\n"); fprintf(stderr, "fatal error: basic OpenSSL failure\n");
ERR_clear_error(); ERR_clear_error();
exit(1); exit(EXIT_FAILURE);
} }
/* e = 0x1000000000001 */ /* e = 0x1000000000001 */
@ -101,7 +101,7 @@ main(int argc, char **argv) {
"at file %s line %d\n", "at file %s line %d\n",
__FILE__, __LINE__); __FILE__, __LINE__);
ERR_clear_error(); ERR_clear_error();
exit(1); exit(EXIT_FAILURE);
} }
isc_mem_create(&mctx); isc_mem_create(&mctx);

View File

@ -428,5 +428,5 @@ main(int argc, char **argv) {
teardown(); teardown();
exit(EXIT_SUCCESS); return (EXIT_SUCCESS);
} }

View File

@ -303,5 +303,5 @@ main(int argc, char **argv) {
teardown(); teardown();
exit(EXIT_SUCCESS); return (EXIT_SUCCESS);
} }

View File

@ -41,7 +41,7 @@ CHECKRESULT(isc_result_t result, const char *msg) {
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
printf("%s: %s\n", msg, isc_result_totext(result)); printf("%s: %s\n", msg, isc_result_totext(result));
exit(1); exit(EXIT_FAILURE);
} }
} }
@ -163,7 +163,7 @@ main(int argc, char *argv[]) {
break; break;
default: default:
usage(); usage();
exit(1); exit(EXIT_FAILURE);
} }
} }
@ -174,7 +174,7 @@ main(int argc, char *argv[]) {
f = fopen(argv[0], "r"); f = fopen(argv[0], "r");
if (f == NULL) { if (f == NULL) {
fprintf(stderr, "%s: fopen failed\n", argv[0]); fprintf(stderr, "%s: fopen failed\n", argv[0]);
exit(1); exit(EXIT_FAILURE);
} }
need_close = true; need_close = true;
} else { } else {
@ -214,7 +214,7 @@ main(int argc, char *argv[]) {
if (len % 2 != 0U) { if (len % 2 != 0U) {
fprintf(stderr, "bad input format: %lu\n", fprintf(stderr, "bad input format: %lu\n",
(unsigned long)len); (unsigned long)len);
exit(1); exit(EXIT_FAILURE);
} }
rp = s; rp = s;
@ -239,13 +239,13 @@ main(int argc, char *argv[]) {
if (isc_buffer_remaininglength(input) < 2) { if (isc_buffer_remaininglength(input) < 2) {
fprintf(stderr, "premature end of packet\n"); fprintf(stderr, "premature end of packet\n");
exit(1); exit(EXIT_FAILURE);
} }
tcplen = isc_buffer_getuint16(input); tcplen = isc_buffer_getuint16(input);
if (isc_buffer_remaininglength(input) < tcplen) { if (isc_buffer_remaininglength(input) < tcplen) {
fprintf(stderr, "premature end of packet\n"); fprintf(stderr, "premature end of packet\n");
exit(1); exit(EXIT_FAILURE);
} }
process_message(input); process_message(input);
} }

View File

@ -361,7 +361,7 @@ main(int argc, char *argv[]) {
break; break;
default: default:
usage(); usage();
exit(1); exit(EXIT_FAILURE);
} }
} }

View File

@ -56,7 +56,7 @@
if ((x) != ISC_R_SUCCESS) { \ if ((x) != ISC_R_SUCCESS) { \
fprintf(stderr, "mdig: %s failed with %s\n", (str), \ fprintf(stderr, "mdig: %s failed with %s\n", (str), \
isc_result_totext(x)); \ isc_result_totext(x)); \
exit(-1); \ exit(EXIT_FAILURE); \
} \ } \
} }
@ -207,7 +207,7 @@ recvresponse(void *arg) {
if (continue_on_error) { if (continue_on_error) {
goto cleanup; goto cleanup;
} else { } else {
exit(-1); exit(EXIT_FAILURE);
} }
} }
@ -785,7 +785,7 @@ usage(void) {
" {local-opt} [ host {local-opt} [...]]\n" " {local-opt} [ host {local-opt} [...]]\n"
"\nUse \"mdig -h\" (or \"mdig -h | more\") " "\nUse \"mdig -h\" (or \"mdig -h | more\") "
"for complete list of options\n"); "for complete list of options\n");
exit(1); exit(EXIT_FAILURE);
} }
/*% help */ /*% help */
@ -1690,7 +1690,7 @@ dash_option(const char *option, char *next, struct query *query, bool global,
break; break;
case 'h': case 'h':
help(); help();
exit(0); exit(EXIT_SUCCESS);
break; break;
case 'i': case 'i':
fatal("-%c removed", opt); fatal("-%c removed", opt);
@ -1701,7 +1701,7 @@ dash_option(const char *option, char *next, struct query *query, bool global,
break; break;
case 'v': case 'v':
printf("mDiG %s\n", PACKAGE_VERSION); printf("mDiG %s\n", PACKAGE_VERSION);
exit(0); exit(EXIT_SUCCESS);
break; break;
} }
if (strlen(option) > 1U) { if (strlen(option) > 1U) {

View File

@ -30,7 +30,7 @@ const char *progname = NULL;
static void static void
usage(void) { usage(void) {
fprintf(stderr, "Usage: %s [-dux] journal\n", progname); fprintf(stderr, "Usage: %s [-dux] journal\n", progname);
exit(1); exit(EXIT_FAILURE);
} }
/* /*
@ -84,7 +84,7 @@ main(int argc, char **argv) {
if (endp == isc_commandline_argument || *endp != 0) { if (endp == isc_commandline_argument || *endp != 0) {
fprintf(stderr, "invalid serial: %s\n", fprintf(stderr, "invalid serial: %s\n",
isc_commandline_argument); isc_commandline_argument);
exit(1); exit(EXIT_FAILURE);
} }
break; break;
case 'd': case 'd':

View File

@ -33,7 +33,7 @@ main(int argc, char *argv[]) {
if (argc != 2) { if (argc != 2) {
fprintf(stderr, "Usage: named-nzd2nzf <nzd-path>\n"); fprintf(stderr, "Usage: named-nzd2nzf <nzd-path>\n");
exit(1); exit(EXIT_FAILURE);
} }
path = argv[1]; path = argv[1];
@ -42,35 +42,35 @@ main(int argc, char *argv[]) {
if (status != MDB_SUCCESS) { if (status != MDB_SUCCESS) {
fprintf(stderr, "named-nzd2nzf: mdb_env_create: %s", fprintf(stderr, "named-nzd2nzf: mdb_env_create: %s",
mdb_strerror(status)); mdb_strerror(status));
exit(1); exit(EXIT_FAILURE);
} }
status = mdb_env_open(env, path, DNS_LMDB_FLAGS, 0600); status = mdb_env_open(env, path, DNS_LMDB_FLAGS, 0600);
if (status != MDB_SUCCESS) { if (status != MDB_SUCCESS) {
fprintf(stderr, "named-nzd2nzf: mdb_env_open: %s", fprintf(stderr, "named-nzd2nzf: mdb_env_open: %s",
mdb_strerror(status)); mdb_strerror(status));
exit(1); exit(EXIT_FAILURE);
} }
status = mdb_txn_begin(env, 0, MDB_RDONLY, &txn); status = mdb_txn_begin(env, 0, MDB_RDONLY, &txn);
if (status != MDB_SUCCESS) { if (status != MDB_SUCCESS) {
fprintf(stderr, "named-nzd2nzf: mdb_txn_begin: %s", fprintf(stderr, "named-nzd2nzf: mdb_txn_begin: %s",
mdb_strerror(status)); mdb_strerror(status));
exit(1); exit(EXIT_FAILURE);
} }
status = mdb_dbi_open(txn, NULL, 0, &dbi); status = mdb_dbi_open(txn, NULL, 0, &dbi);
if (status != MDB_SUCCESS) { if (status != MDB_SUCCESS) {
fprintf(stderr, "named-nzd2nzf: mdb_dbi_open: %s", fprintf(stderr, "named-nzd2nzf: mdb_dbi_open: %s",
mdb_strerror(status)); mdb_strerror(status));
exit(1); exit(EXIT_FAILURE);
} }
status = mdb_cursor_open(txn, dbi, &cursor); status = mdb_cursor_open(txn, dbi, &cursor);
if (status != MDB_SUCCESS) { if (status != MDB_SUCCESS) {
fprintf(stderr, "named-nzd2nzf: mdb_cursor_open: %s", fprintf(stderr, "named-nzd2nzf: mdb_cursor_open: %s",
mdb_strerror(status)); mdb_strerror(status));
exit(1); exit(EXIT_FAILURE);
} }
for (status = mdb_cursor_get(cursor, &key, &data, MDB_FIRST); for (status = mdb_cursor_get(cursor, &key, &data, MDB_FIRST);
@ -84,7 +84,7 @@ main(int argc, char *argv[]) {
"named-nzd2nzf: empty column found in " "named-nzd2nzf: empty column found in "
"database '%s'", "database '%s'",
path); path);
exit(1); exit(EXIT_FAILURE);
} }
/* zone zonename { config; }; */ /* zone zonename { config; }; */
@ -96,5 +96,6 @@ main(int argc, char *argv[]) {
mdb_cursor_close(cursor); mdb_cursor_close(cursor);
mdb_txn_abort(txn); mdb_txn_abort(txn);
mdb_env_close(env); mdb_env_close(env);
exit(0);
return (0);
} }

View File

@ -49,7 +49,7 @@ usage(void) {
fprintf(stderr, "\t-P: list the supported private type names\n"); fprintf(stderr, "\t-P: list the supported private type names\n");
fprintf(stderr, "\t-T: list the supported standard type names\n"); fprintf(stderr, "\t-T: list the supported standard type names\n");
fprintf(stderr, "\t-u: print the record in unknown record format\n"); fprintf(stderr, "\t-u: print the record in unknown record format\n");
exit(0); exit(EXIT_SUCCESS);
} }
static void static void
@ -125,7 +125,7 @@ main(int argc, char *argv[]) {
fprintf(stdout, "%s\n", text); fprintf(stdout, "%s\n", text);
} }
} }
exit(0); exit(EXIT_SUCCESS);
case 'P': case 'P':
for (t = 0xff00; t <= 0xfffeu; t++) { for (t = 0xff00; t <= 0xfffeu; t++) {
@ -161,11 +161,11 @@ main(int argc, char *argv[]) {
default: default:
fprintf(stderr, "%s: unhandled option -%c\n", argv[0], fprintf(stderr, "%s: unhandled option -%c\n", argv[0],
isc_commandline_option); isc_commandline_option);
exit(1); exit(EXIT_FAILURE);
} }
} }
if (doexit) { if (doexit) {
exit(0); exit(EXIT_SUCCESS);
} }
isc_mem_create(&mctx); isc_mem_create(&mctx);

View File

@ -49,7 +49,7 @@ fatal(const char *format, ...) {
va_end(args); va_end(args);
fprintf(stderr, "\n"); fprintf(stderr, "\n");
isc__tls_setfatalmode(); isc__tls_setfatalmode();
_exit(1); _exit(EXIT_FAILURE);
} }
static void static void
@ -65,7 +65,7 @@ usage(void) {
program); program);
fprintf(stderr, " %s -r algorithm flags iterations salt domain\n", fprintf(stderr, " %s -r algorithm flags iterations salt domain\n",
program); program);
exit(1); exit(EXIT_FAILURE);
} }
typedef void typedef void

View File

@ -38,7 +38,7 @@ check_result(isc_result_t result, const char *format, ...) {
vfprintf(stderr, format, args); vfprintf(stderr, format, args);
va_end(args); va_end(args);
fprintf(stderr, ": %s\n", isc_result_totext(result)); fprintf(stderr, ": %s\n", isc_result_totext(result));
exit(1); exit(EXIT_FAILURE);
} }
static void static void
@ -52,7 +52,7 @@ usage(void) {
fprintf(stderr, "usage: cfg_test --rndc|--named " fprintf(stderr, "usage: cfg_test --rndc|--named "
"[--grammar] [--zonegrammar] [--active] " "[--grammar] [--zonegrammar] [--active] "
"[--memstats] conffile\n"); "[--memstats] conffile\n");
exit(1); exit(EXIT_FAILURE);
} }
int int
@ -166,7 +166,7 @@ main(int argc, char **argv) {
fprintf(stderr, "read config: %s\n", isc_result_totext(result)); fprintf(stderr, "read config: %s\n", isc_result_totext(result));
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
exit(1); exit(EXIT_FAILURE);
} }
cfg_print(cfg, output, NULL); cfg_print(cfg, output, NULL);
@ -186,7 +186,7 @@ main(int argc, char **argv) {
if (ferror(stdout)) { if (ferror(stdout)) {
fprintf(stderr, "write error\n"); fprintf(stderr, "write error\n");
return (1); return (1);
} else {
return (0);
} }
return (0);
} }

View File

@ -218,7 +218,7 @@ next_file(isc_dir_t *dir) {
fprintf(stderr, fprintf(stderr,
"Error: reading directory: %s\n", "Error: reading directory: %s\n",
strerror(errno)); strerror(errno));
exit(1); exit(EXIT_FAILURE);
} }
} }
} }
@ -366,14 +366,14 @@ insert_into_typenames(int type, const char *typebuf, const char *attr) {
fprintf(stderr, fprintf(stderr,
"Error: type %d has two names: %s, %s\n", type, "Error: type %d has two names: %s, %s\n", type,
typenames[i].typebuf, typebuf); typenames[i].typebuf, typebuf);
exit(1); exit(EXIT_FAILURE);
} }
ttn = &typenames[i]; ttn = &typenames[i];
} }
/* Subtract one to leave an empty sentinel entry at the end */ /* Subtract one to leave an empty sentinel entry at the end */
if (i >= TYPENAMES - 1) { if (i >= TYPENAMES - 1) {
fprintf(stderr, "Error: typenames array too small\n"); fprintf(stderr, "Error: typenames array too small\n");
exit(1); exit(EXIT_FAILURE);
} else if (ttn == NULL) { } else if (ttn == NULL) {
ttn = &typenames[i]; ttn = &typenames[i];
ttnam_count = i + 1; ttnam_count = i + 1;
@ -382,7 +382,7 @@ insert_into_typenames(int type, const char *typebuf, const char *attr) {
/* XXXMUKS: This is redundant due to the INSIST above. */ /* XXXMUKS: This is redundant due to the INSIST above. */
if (strlen(typebuf) > sizeof(ttn->typebuf) - 1) { if (strlen(typebuf) > sizeof(ttn->typebuf) - 1) {
fprintf(stderr, "Error: type name %s is too long\n", typebuf); fprintf(stderr, "Error: type name %s is too long\n", typebuf);
exit(1); exit(EXIT_FAILURE);
} }
strncpy(ttn->typebuf, typebuf, sizeof(ttn->typebuf)); strncpy(ttn->typebuf, typebuf, sizeof(ttn->typebuf));
@ -412,13 +412,13 @@ insert_into_typenames(int type, const char *typebuf, const char *attr) {
"Error: type %d has different attributes: " "Error: type %d has different attributes: "
"%s, %s\n", "%s, %s\n",
type, ttn->attr, attr); type, ttn->attr, attr);
exit(1); exit(EXIT_FAILURE);
} }
if (strlen(attr) > sizeof(ttn->attr) - 1) { if (strlen(attr) > sizeof(ttn->attr) - 1) {
fprintf(stderr, "Error: attr (%s) [name %s] is too long\n", fprintf(stderr, "Error: attr (%s) [name %s] is too long\n",
attr, typebuf); attr, typebuf);
exit(1); exit(EXIT_FAILURE);
} }
strncpy(ttn->attr, attr, sizeof(ttn->attr)); strncpy(ttn->attr, attr, sizeof(ttn->attr));
@ -444,7 +444,7 @@ add(unsigned int rdclass, const char *classbuf, int type, const char *typebuf,
if (newtt == NULL) { if (newtt == NULL) {
fprintf(stderr, "malloc() failed\n"); fprintf(stderr, "malloc() failed\n");
exit(1); exit(EXIT_FAILURE);
} }
newtt->next = NULL; newtt->next = NULL;
@ -496,7 +496,7 @@ add(unsigned int rdclass, const char *classbuf, int type, const char *typebuf,
newcc = (struct cc *)malloc(sizeof(*newcc)); newcc = (struct cc *)malloc(sizeof(*newcc));
if (newcc == NULL) { if (newcc == NULL) {
fprintf(stderr, "malloc() failed\n"); fprintf(stderr, "malloc() failed\n");
exit(1); exit(EXIT_FAILURE);
} }
newcc->rdclass = rdclass; newcc->rdclass = rdclass;
strncpy(newcc->classbuf, classbuf, sizeof(newcc->classbuf)); strncpy(newcc->classbuf, classbuf, sizeof(newcc->classbuf));
@ -554,7 +554,7 @@ sd(unsigned int rdclass, const char *classbuf, const char *dirbuf,
if (type > 65535) { if (type > 65535) {
fprintf(stderr, "Error: type value > 65535 (%s)\n", fprintf(stderr, "Error: type value > 65535 (%s)\n",
dir.filename); dir.filename);
exit(1); exit(EXIT_FAILURE);
} }
add(rdclass, classbuf, type, typebuf, dirbuf); add(rdclass, classbuf, type, typebuf, dirbuf);
} }
@ -638,7 +638,7 @@ main(int argc, char **argv) {
sizeof("/rdata/_65535_65535")) sizeof("/rdata/_65535_65535"))
{ {
fprintf(stderr, "\"%s\" too long\n", optarg); fprintf(stderr, "\"%s\" too long\n", optarg);
exit(1); exit(EXIT_FAILURE);
} }
n = snprintf(srcdir, sizeof(srcdir), "%s/", optarg); n = snprintf(srcdir, sizeof(srcdir), "%s/", optarg);
INSIST(n > 0 && (unsigned int)n < sizeof(srcdir)); INSIST(n > 0 && (unsigned int)n < sizeof(srcdir));
@ -653,7 +653,7 @@ main(int argc, char **argv) {
suffix = optarg; suffix = optarg;
break; break;
case '?': case '?':
exit(1); exit(EXIT_FAILURE);
} }
} }
@ -682,7 +682,7 @@ main(int argc, char **argv) {
if (rdclass > 65535) { if (rdclass > 65535) {
fprintf(stderr, "Error: class value > 65535 (%s)\n", fprintf(stderr, "Error: class value > 65535 (%s)\n",
dir.filename); dir.filename);
exit(1); exit(EXIT_FAILURE);
} }
sd(rdclass, classbuf, buf, filetype); sd(rdclass, classbuf, buf, filetype);
} }
@ -1023,7 +1023,7 @@ main(int argc, char **argv) {
} }
if (ferror(stdout) != 0) { if (ferror(stdout) != 0) {
exit(1); exit(EXIT_FAILURE);
} }
return (0); return (0);

View File

@ -74,7 +74,7 @@ enable_fips_mode(void) {
if (isc_fips_set_mode(1) != ISC_R_SUCCESS) { if (isc_fips_set_mode(1) != ISC_R_SUCCESS) {
dst__openssl_toresult2("FIPS_mode_set", DST_R_OPENSSLFAILURE); dst__openssl_toresult2("FIPS_mode_set", DST_R_OPENSSLFAILURE);
exit(1); exit(EXIT_FAILURE);
} }
#endif #endif
} }

View File

@ -31,7 +31,7 @@ static void
CHECKRESULT(isc_result_t result, const char *msg) { CHECKRESULT(isc_result_t result, const char *msg) {
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
printf("%s: %s\n", msg, isc_result_totext(result)); printf("%s: %s\n", msg, isc_result_totext(result));
exit(1); exit(EXIT_FAILURE);
} }
} }

View File

@ -87,7 +87,7 @@ const dns_qpmethods_t qpmethods = {
dns_name_format(name, buf, sizeof(buf)); \ dns_name_format(name, buf, sizeof(buf)); \
fprintf(stderr, "%s: %s\n", buf, \ fprintf(stderr, "%s: %s\n", buf, \
isc_result_totext(result)); \ isc_result_totext(result)); \
exit(1); \ exit(EXIT_FAILURE); \
} \ } \
} while (0) } while (0)
@ -459,7 +459,7 @@ static struct fun fun_list[] = {
do { \ do { \
if (!(check)) { \ if (!(check)) { \
fprintf(stderr, "%s:%zu: %s\n", filename, lines, msg); \ fprintf(stderr, "%s:%zu: %s\n", filename, lines, msg); \
exit(1); \ exit(EXIT_FAILURE); \
} \ } \
} while (0) } while (0)
@ -480,7 +480,7 @@ main(int argc, char *argv[]) {
if (argc != 2) { if (argc != 2) {
fprintf(stderr, fprintf(stderr,
"usage: load-names <filename.csv> <nthreads>\n"); "usage: load-names <filename.csv> <nthreads>\n");
exit(1); exit(EXIT_FAILURE);
} }
filename = argv[1]; filename = argv[1];
@ -488,7 +488,7 @@ main(int argc, char *argv[]) {
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
fprintf(stderr, "stat(%s): %s\n", filename, fprintf(stderr, "stat(%s): %s\n", filename,
isc_result_totext(result)); isc_result_totext(result));
exit(1); exit(EXIT_FAILURE);
} }
filesize = (size_t)fileoff; filesize = (size_t)fileoff;
@ -496,7 +496,7 @@ main(int argc, char *argv[]) {
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp == NULL || fread(filetext, 1, filesize, fp) < filesize) { if (fp == NULL || fread(filetext, 1, filesize, fp) < filesize) {
fprintf(stderr, "read(%s): %s\n", filename, strerror(errno)); fprintf(stderr, "read(%s): %s\n", filename, strerror(errno));
exit(1); exit(EXIT_FAILURE);
} }
fclose(fp); fclose(fp);
filetext[filesize] = '\0'; filetext[filesize] = '\0';

View File

@ -152,7 +152,7 @@ main(int argc, char *argv[]) {
continue; continue;
default: default:
usage(); usage();
exit(1); exit(EXIT_FAILURE);
continue; continue;
} }
} }
@ -162,7 +162,7 @@ main(int argc, char *argv[]) {
if (argc != 1) { if (argc != 1) {
/* must exit 0 to appease test runner */ /* must exit 0 to appease test runner */
usage(); usage();
exit(0); exit(EXIT_SUCCESS);
} }
isc_mem_create(&mctx); isc_mem_create(&mctx);
@ -172,7 +172,7 @@ main(int argc, char *argv[]) {
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
fprintf(stderr, "stat(%s): %s\n", filename, fprintf(stderr, "stat(%s): %s\n", filename,
isc_result_totext(result)); isc_result_totext(result));
exit(1); exit(EXIT_FAILURE);
} }
filesize = (size_t)fileoff; filesize = (size_t)fileoff;
@ -180,7 +180,7 @@ main(int argc, char *argv[]) {
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp == NULL || fread(filetext, 1, filesize, fp) < filesize) { if (fp == NULL || fread(filetext, 1, filesize, fp) < filesize) {
fprintf(stderr, "read(%s): %s\n", filename, strerror(errno)); fprintf(stderr, "read(%s): %s\n", filename, strerror(errno));
exit(1); exit(EXIT_FAILURE);
} }
fclose(fp); fclose(fp);
filetext[filesize] = '\0'; filetext[filesize] = '\0';
@ -220,7 +220,7 @@ main(int argc, char *argv[]) {
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
fprintf(stderr, "%s:%zu: %s %s\n", filename, names, fprintf(stderr, "%s:%zu: %s %s\n", filename, names,
domain, isc_result_totext(result)); domain, isc_result_totext(result));
exit(1); exit(EXIT_FAILURE);
} }
wirebytes += name->length; wirebytes += name->length;

View File

@ -124,7 +124,7 @@ const dns_qpmethods_t methods = {
static void static void
usage(void) { usage(void) {
fprintf(stderr, "usage: lookups <filename>\n"); fprintf(stderr, "usage: lookups <filename>\n");
exit(0); exit(EXIT_FAILURE);
} }
static size_t static size_t
@ -140,7 +140,7 @@ load_qp(dns_qp_t *qp, const char *filename) {
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
fprintf(stderr, "stat(%s): %s\n", filename, fprintf(stderr, "stat(%s): %s\n", filename,
isc_result_totext(result)); isc_result_totext(result));
exit(1); exit(EXIT_FAILURE);
} }
filesize = (size_t)fileoff; filesize = (size_t)fileoff;
@ -148,7 +148,7 @@ load_qp(dns_qp_t *qp, const char *filename) {
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp == NULL || fread(filetext, 1, filesize, fp) < filesize) { if (fp == NULL || fread(filetext, 1, filesize, fp) < filesize) {
fprintf(stderr, "read(%s): %s\n", filename, strerror(errno)); fprintf(stderr, "read(%s): %s\n", filename, strerror(errno));
exit(1); exit(EXIT_FAILURE);
} }
fclose(fp); fclose(fp);
filetext[filesize] = '\0'; filetext[filesize] = '\0';
@ -186,7 +186,7 @@ load_qp(dns_qp_t *qp, const char *filename) {
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
fprintf(stderr, "%s:%zu: %s %s\n", filename, names, fprintf(stderr, "%s:%zu: %s %s\n", filename, names,
domain, isc_result_totext(result)); domain, isc_result_totext(result));
exit(1); exit(EXIT_FAILURE);
} }
names++; names++;