diff --git a/lib/iolog/regress/iolog_path/check_iolog_path.c b/lib/iolog/regress/iolog_path/check_iolog_path.c index 11f77d444..4e5dc683c 100644 --- a/lib/iolog/regress/iolog_path/check_iolog_path.c +++ b/lib/iolog/regress/iolog_path/check_iolog_path.c @@ -54,7 +54,7 @@ static void usage(void) { fprintf(stderr, "usage: %s datafile\n", getprogname()); - exit(1); + exit(EXIT_FAILURE); } static void diff --git a/lib/util/mksiglist.c b/lib/util/mksiglist.c index 0c5b27a49..122200cbd 100644 --- a/lib/util/mksiglist.c +++ b/lib/util/mksiglist.c @@ -56,5 +56,5 @@ main(int argc, char *argv[]) } printf("};\n"); - exit(0); + exit(EXIT_SUCCESS); } diff --git a/lib/util/mksigname.c b/lib/util/mksigname.c index 32e3e17a0..8693fe882 100644 --- a/lib/util/mksigname.c +++ b/lib/util/mksigname.c @@ -56,5 +56,5 @@ main(int argc, char *argv[]) } printf("};\n"); - exit(0); + exit(EXIT_SUCCESS); } diff --git a/lib/util/regress/fnmatch/fnm_test.c b/lib/util/regress/fnmatch/fnm_test.c index a70a84786..85589d1c5 100644 --- a/lib/util/regress/fnmatch/fnm_test.c +++ b/lib/util/regress/fnmatch/fnm_test.c @@ -39,7 +39,7 @@ main(int argc, char *argv[]) if (argc > 1) { if ((fp = fopen(argv[1], "r")) == NULL) { perror(argv[1]); - exit(1); + exit(EXIT_FAILURE); } } diff --git a/lib/util/regress/getdelim/getdelim_test.c b/lib/util/regress/getdelim/getdelim_test.c index 7c399ddcf..b813c451e 100644 --- a/lib/util/regress/getdelim/getdelim_test.c +++ b/lib/util/regress/getdelim/getdelim_test.c @@ -87,7 +87,7 @@ runtests(char **buf, size_t *buflen) sudo_warn_nodebug("send"); _exit(127); } - _exit(0); + _exit(EXIT_SUCCESS); break; default: /* parent */ diff --git a/lib/util/regress/glob/globtest.c b/lib/util/regress/glob/globtest.c index 99859f0ba..707af613a 100644 --- a/lib/util/regress/glob/globtest.c +++ b/lib/util/regress/glob/globtest.c @@ -51,7 +51,7 @@ main(int argc, char **argv) if (argc > 1) { if ((fp = fopen(argv[1], "r")) == NULL) { perror(argv[1]); - exit(1); + exit(EXIT_FAILURE); } } @@ -74,7 +74,7 @@ main(int argc, char **argv) if (buf[len - 1] != '\n') { fprintf(stderr, "globtest: missing newline at EOF\n"); - exit(1); + exit(EXIT_FAILURE); } buf[--len] = '\0'; } @@ -93,14 +93,14 @@ main(int argc, char **argv) fprintf(stderr, "globtest: invalid entry on line %d\n", lineno); - exit(1); + exit(EXIT_FAILURE); } len = cp - buf - 1; if (len >= sizeof(entry.pattern)) { fprintf(stderr, "globtest: pattern too big on line %d\n", lineno); - exit(1); + exit(EXIT_FAILURE); } memcpy(entry.pattern, buf + 1, len); entry.pattern[len] = '\0'; @@ -110,14 +110,14 @@ main(int argc, char **argv) fprintf(stderr, "globtest: invalid entry on line %d\n", lineno); - exit(1); + exit(EXIT_FAILURE); } ep = strchr(cp, '>'); if (ep == NULL) { fprintf(stderr, "globtest: invalid entry on line %d\n", lineno); - exit(1); + exit(EXIT_FAILURE); } *ep = '\0'; entry.flags = 0; @@ -144,7 +144,7 @@ main(int argc, char **argv) fprintf(stderr, "globtest: invalid flags on line %d\n", lineno); - exit(1); + exit(EXIT_FAILURE); } } entry.nresults = 0; @@ -153,14 +153,14 @@ main(int argc, char **argv) if (!entry.pattern[0]) { fprintf(stderr, "globtest: missing entry on line %d\n", lineno); - exit(1); + exit(EXIT_FAILURE); } if (entry.nresults + 1 > MAX_RESULTS) { fprintf(stderr, "globtest: too many results for %s, max %d\n", entry.pattern, MAX_RESULTS); - exit(1); + exit(EXIT_FAILURE); } entry.results[entry.nresults++] = strdup(buf); } @@ -185,7 +185,7 @@ int test_glob(struct gl_entry *entry) if (glob(entry->pattern, entry->flags, NULL, &gl) != 0) { fprintf(stderr, "glob failed: %s: %s\n", entry->pattern, strerror(errno)); - exit(1); + exit(EXIT_FAILURE); } for (ap = gl.gl_pathv; *ap != NULL; ap++) diff --git a/lib/util/regress/parse_gids/parse_gids_test.c b/lib/util/regress/parse_gids/parse_gids_test.c index efe7f6d29..9c16bbfdd 100644 --- a/lib/util/regress/parse_gids/parse_gids_test.c +++ b/lib/util/regress/parse_gids/parse_gids_test.c @@ -87,7 +87,7 @@ main(int argc, char *argv[]) free(gidlist); ngids = sudo_parse_gids(test_data[i].gids, test_data[i].baseptr, &gidlist); if (ngids == -1) - exit(1); /* out of memory? */ + exit(EXIT_FAILURE); /* out of memory? */ ntests++; if (ngids != test_data[i].ngids) { sudo_warnx_nodebug("test #%d: expected %d gids, got %d", diff --git a/lib/util/regress/progname/progname_test.c b/lib/util/regress/progname/progname_test.c index 4e99feb55..34cb3c95d 100644 --- a/lib/util/regress/progname/progname_test.c +++ b/lib/util/regress/progname/progname_test.c @@ -60,8 +60,8 @@ main(int argc, char *argv[]) if (strcmp(getprogname(), progbase) != 0) { printf("%s: FAIL: incorrect program name \"%s\"\n", progbase, getprogname()); - exit(1); + exit(EXIT_FAILURE); } - exit(0); + exit(EXIT_SUCCESS); } diff --git a/lib/util/regress/sudo_parseln/parseln_test.c b/lib/util/regress/sudo_parseln/parseln_test.c index 68d984b26..ecf9d3d9c 100644 --- a/lib/util/regress/sudo_parseln/parseln_test.c +++ b/lib/util/regress/sudo_parseln/parseln_test.c @@ -56,5 +56,5 @@ main(int argc, char *argv[]) while (sudo_parseln(&line, &linesize, &lineno, stdin, 0) != -1) printf("%6u\t%s\n", lineno, line); free(line); - exit(0); + exit(EXIT_SUCCESS); } diff --git a/logsrvd/logsrvd.c b/logsrvd/logsrvd.c index d2f003a3f..14443cc00 100644 --- a/logsrvd/logsrvd.c +++ b/logsrvd/logsrvd.c @@ -1604,7 +1604,7 @@ daemonize(bool nofork) break; default: /* parent, exit */ - _exit(0); + _exit(EXIT_SUCCESS); } } @@ -1627,7 +1627,7 @@ usage(bool fatal) fprintf(stderr, "usage: %s [-n] [-f conf_file] [-R percentage]\n", getprogname()); if (fatal) - exit(1); + exit(EXIT_FAILURE); } static void @@ -1642,7 +1642,7 @@ help(void) " -n, --no-fork do not fork, run in the foreground\n" " -R, --random-drop percent chance connections will drop\n" " -V, --version display version information and exit\n")); - exit(0); + exit(EXIT_SUCCESS); } static const char short_opts[] = "f:hnR:V"; diff --git a/logsrvd/sendlog.c b/logsrvd/sendlog.c index 04e2325ea..d78a139ac 100644 --- a/logsrvd/sendlog.c +++ b/logsrvd/sendlog.c @@ -104,7 +104,7 @@ usage(bool fatal) fprintf(stderr, "usage: %s [-h host] [-i iolog-id] [-p port] " #endif "[-r restart-point] /path/to/iolog\n", getprogname()); - exit(1); + exit(EXIT_FAILURE); } static void @@ -126,7 +126,7 @@ help(void) " -k, --key private key file\n" #endif " -V, --version display version information and exit\n")); - exit(0); + exit(EXIT_SUCCESS); } #if defined(HAVE_OPENSSL) diff --git a/plugins/group_file/plugin_test.c b/plugins/group_file/plugin_test.c index 947836209..dba784c23 100644 --- a/plugins/group_file/plugin_test.c +++ b/plugins/group_file/plugin_test.c @@ -175,7 +175,7 @@ usage(void) { fprintf(stderr, "usage: plugin_test [-p \"plugin.so plugin_args ...\"] user:group ...\n"); - exit(1); + exit(EXIT_FAILURE); } int @@ -203,7 +203,7 @@ main(int argc, char *argv[]) if (group_plugin_load(plugin) != 1) { fprintf(stderr, "unable to load plugin: %s\n", plugin); - exit(1); + exit(EXIT_FAILURE); } for (i = 0; argv[i] != NULL; i++) { @@ -218,6 +218,6 @@ main(int argc, char *argv[]) } group_plugin_unload(); - exit(0); + exit(EXIT_SUCCESS); } diff --git a/plugins/sudoers/cvtsudoers.c b/plugins/sudoers/cvtsudoers.c index c6e2a06da..d8164abd5 100644 --- a/plugins/sudoers/cvtsudoers.c +++ b/plugins/sudoers/cvtsudoers.c @@ -1310,7 +1310,7 @@ usage(int fatal) "[-I increment] [-m filter] [-o output_file] [-O start_point] " "[-P padding] [-s sections] [input_file]\n", getprogname()); if (fatal) - exit(1); + exit(EXIT_FAILURE); } static void @@ -1335,5 +1335,5 @@ help(void) " -P, --padding=num base padding for sudoOrder increment\n" " -s, --suppress=sections suppress output of certain sections\n" " -V, --version display version information and exit")); - exit(0); + exit(EXIT_SUCCESS); } diff --git a/plugins/sudoers/logging.c b/plugins/sudoers/logging.c index 643ea9828..92229ea56 100644 --- a/plugins/sudoers/logging.c +++ b/plugins/sudoers/logging.c @@ -801,14 +801,14 @@ send_mail(const char *fmt, ...) sudo_debug_printf(SUDO_DEBUG_ERROR, "unable to fork: %s", strerror(errno)); sudo_debug_exit(__func__, __FILE__, __LINE__, sudo_debug_subsys); - _exit(1); + _exit(EXIT_FAILURE); case 0: /* Grandchild continues below. */ sudo_debug_enter(__func__, __FILE__, __LINE__, sudo_debug_subsys); break; default: /* Parent will wait for us. */ - _exit(0); + _exit(EXIT_SUCCESS); } break; default: @@ -847,7 +847,7 @@ send_mail(const char *fmt, ...) sudo_debug_printf(SUDO_DEBUG_ERROR, "unable to open pipe: %s", strerror(errno)); sudo_debug_exit(__func__, __FILE__, __LINE__, sudo_debug_subsys); - _exit(1); + _exit(EXIT_FAILURE); } switch (pid = sudo_debug_fork()) { @@ -857,7 +857,7 @@ send_mail(const char *fmt, ...) sudo_debug_printf(SUDO_DEBUG_ERROR, "unable to fork: %s", strerror(errno)); sudo_debug_exit(__func__, __FILE__, __LINE__, sudo_debug_subsys); - _exit(1); + _exit(EXIT_FAILURE); break; case 0: /* Child. */ @@ -913,7 +913,7 @@ send_mail(const char *fmt, ...) sudo_debug_printf(SUDO_DEBUG_INFO|SUDO_DEBUG_LINENO, "child (%d) exit value %d", (int)rv, status); sudo_debug_exit(__func__, __FILE__, __LINE__, sudo_debug_subsys); - _exit(0); + _exit(EXIT_SUCCESS); } /* diff --git a/plugins/sudoers/regress/check_symbols/check_symbols.c b/plugins/sudoers/regress/check_symbols/check_symbols.c index ccb2ad773..a1c15163b 100644 --- a/plugins/sudoers/regress/check_symbols/check_symbols.c +++ b/plugins/sudoers/regress/check_symbols/check_symbols.c @@ -41,7 +41,7 @@ static void usage(void) { fprintf(stderr, "usage: %s plugin.so symbols_file\n", getprogname()); - exit(1); + exit(EXIT_FAILURE); } int diff --git a/plugins/sudoers/regress/env_match/check_env_pattern.c b/plugins/sudoers/regress/env_match/check_env_pattern.c index eece41e57..1855bceb9 100644 --- a/plugins/sudoers/regress/env_match/check_env_pattern.c +++ b/plugins/sudoers/regress/env_match/check_env_pattern.c @@ -46,7 +46,7 @@ main(int argc, char *argv[]) if (argc > 1) { if ((fp = fopen(argv[1], "r")) == NULL) { perror(argv[1]); - exit(1); + exit(EXIT_FAILURE); } } diff --git a/plugins/sudoers/regress/iolog_plugin/check_iolog_plugin.c b/plugins/sudoers/regress/iolog_plugin/check_iolog_plugin.c index c11b8bb89..42f1035ec 100644 --- a/plugins/sudoers/regress/iolog_plugin/check_iolog_plugin.c +++ b/plugins/sudoers/regress/iolog_plugin/check_iolog_plugin.c @@ -52,7 +52,7 @@ static void usage(void) { fprintf(stderr, "usage: %s pathname\n", getprogname()); - exit(1); + exit(EXIT_FAILURE); } static int diff --git a/plugins/sudoers/regress/logging/check_wrap.c b/plugins/sudoers/regress/logging/check_wrap.c index a1988f265..c99b4ec55 100644 --- a/plugins/sudoers/regress/logging/check_wrap.c +++ b/plugins/sudoers/regress/logging/check_wrap.c @@ -44,7 +44,7 @@ static void usage(void) { fprintf(stderr, "usage: %s inputfile\n", getprogname()); - exit(1); + exit(EXIT_FAILURE); } int diff --git a/plugins/sudoers/regress/parser/check_addr.c b/plugins/sudoers/regress/parser/check_addr.c index 2a7b0f361..3c7cbcd8f 100644 --- a/plugins/sudoers/regress/parser/check_addr.c +++ b/plugins/sudoers/regress/parser/check_addr.c @@ -77,7 +77,7 @@ static void usage(void) { fprintf(stderr, "usage: %s datafile\n", getprogname()); - exit(1); + exit(EXIT_FAILURE); } int diff --git a/plugins/sudoers/sudoreplay.c b/plugins/sudoers/sudoreplay.c index d6a9c5509..62ecd1ad1 100644 --- a/plugins/sudoers/sudoreplay.c +++ b/plugins/sudoers/sudoreplay.c @@ -1572,7 +1572,7 @@ usage(int fatal) _("usage: %s [-h] [-d dir] -l [search expression]\n"), getprogname()); if (fatal) - exit(1); + exit(EXIT_FAILURE); } static void @@ -1591,7 +1591,7 @@ help(void) " -S, --suspend-wait wait while the command was suspended\n" " -s, --speed=num speed up or slow down output\n" " -V, --version display version information and exit")); - exit(0); + exit(EXIT_SUCCESS); } /* diff --git a/plugins/sudoers/testsudoers.c b/plugins/sudoers/testsudoers.c index 66b35e2b8..80aa1950d 100644 --- a/plugins/sudoers/testsudoers.c +++ b/plugins/sudoers/testsudoers.c @@ -606,5 +606,5 @@ static void usage(void) { (void) fprintf(stderr, "usage: %s [-dt] [-G sudoers_gid] [-g group] [-h host] [-i input_format] [-P grfile] [-p pwfile] [-U sudoers_uid] [-u user] [args]\n", getprogname()); - exit(1); + exit(EXIT_FAILURE); } diff --git a/plugins/sudoers/tsdump.c b/plugins/sudoers/tsdump.c index d69c77d8e..9297b5431 100644 --- a/plugins/sudoers/tsdump.c +++ b/plugins/sudoers/tsdump.c @@ -314,5 +314,5 @@ usage(void) { fprintf(stderr, "usage: %s [-f timestamp_file] | [-u username]\n", getprogname()); - exit(1); + exit(EXIT_FAILURE); } diff --git a/plugins/sudoers/visudo.c b/plugins/sudoers/visudo.c index 6a9925bad..3a39e3402 100644 --- a/plugins/sudoers/visudo.c +++ b/plugins/sudoers/visudo.c @@ -263,7 +263,7 @@ main(int argc, char *argv[]) * errors and to pull in editor and env_editor conf values. */ if ((sudoersin = open_sudoers(sudoers_file, true, NULL)) == NULL) - exit(1); + exit(EXIT_FAILURE); init_parser(sudoers_file, quiet, true); sudoers_setlocale(SUDOERS_LOCALE_SUDOERS, &oldlocale); (void) sudoersparse(); @@ -1283,7 +1283,7 @@ usage(int fatal) (void) fprintf(fatal ? stderr : stdout, "usage: %s [-chqsV] [[-f] sudoers ]\n", getprogname()); if (fatal) - exit(1); + exit(EXIT_FAILURE); } static void @@ -1298,5 +1298,5 @@ help(void) " -q, --quiet less verbose (quiet) syntax error messages\n" " -s, --strict strict syntax checking\n" " -V, --version display version information and exit\n")); - exit(0); + exit(EXIT_SUCCESS); } diff --git a/src/exec.c b/src/exec.c index 8e51dd23b..5337599a0 100644 --- a/src/exec.c +++ b/src/exec.c @@ -363,7 +363,7 @@ sudo_execute(struct command_details *details, struct command_status *cstat) /* parent exits (but does not flush buffers) */ sudo_debug_exit_int(__func__, __FILE__, __LINE__, sudo_debug_subsys, 0); - _exit(0); + _exit(EXIT_SUCCESS); } } diff --git a/src/exec_monitor.c b/src/exec_monitor.c index 87204fef7..fd3267c35 100644 --- a/src/exec_monitor.c +++ b/src/exec_monitor.c @@ -124,7 +124,7 @@ deliver_signal(struct monitor_closure *mc, int signo, bool from_parent) killpg(mc->cmnd_pid, SIGCONT); break; case SIGKILL: - _exit(1); /* XXX */ + _exit(EXIT_FAILURE); /* XXX */ /* NOTREACHED */ default: /* Relay signal to command. */ @@ -635,7 +635,7 @@ exec_monitor(struct command_details *details, sigset_t *oset, exec_cmnd_pty(details, foreground, errpipe[1]); if (write(errpipe[1], &errno, sizeof(int)) == -1) sudo_warn(U_("unable to execute %s"), details->command); - _exit(1); + _exit(EXIT_FAILURE); } close(errpipe[1]); @@ -721,7 +721,7 @@ exec_monitor(struct command_details *details, sigset_t *oset, } #endif sudo_debug_exit_int(__func__, __FILE__, __LINE__, sudo_debug_subsys, 1); - _exit(1); + _exit(EXIT_FAILURE); bad: debug_return_int(-1); diff --git a/src/exec_nopty.c b/src/exec_nopty.c index 577e7b2ce..abea42023 100644 --- a/src/exec_nopty.c +++ b/src/exec_nopty.c @@ -402,7 +402,7 @@ exec_nopty(struct command_details *details, struct command_status *cstat) break; } sudo_debug_exit_int(__func__, __FILE__, __LINE__, sudo_debug_subsys, 1); - _exit(1); + _exit(EXIT_FAILURE); } sudo_debug_printf(SUDO_DEBUG_INFO, "executed %s, pid %d", details->command, (int)ec.cmnd_pid); diff --git a/src/exec_pty.c b/src/exec_pty.c index 9d192b900..9cc37d274 100644 --- a/src/exec_pty.c +++ b/src/exec_pty.c @@ -1553,7 +1553,7 @@ exec_pty(struct command_details *details, struct command_status *cstat) sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_ERRNO, "%s: unable to send status to parent", __func__); } - _exit(1); + _exit(EXIT_FAILURE); } /* diff --git a/src/parse_args.c b/src/parse_args.c index aae71859a..bcdf4ae92 100644 --- a/src/parse_args.c +++ b/src/parse_args.c @@ -583,7 +583,7 @@ parse_args(int argc, char **argv, int *old_optind, int *nargc, char ***nargv, if (cmnd == NULL) sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory")); if (!gc_add(GC_PTR, cmnd)) - exit(1); + exit(EXIT_FAILURE); for (av = argv; *av != NULL; av++) { for (src = *av; *src != '\0'; src++) { @@ -605,7 +605,7 @@ parse_args(int argc, char **argv, int *old_optind, int *nargc, char ***nargv, if (av == NULL) sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory")); if (!gc_add(GC_PTR, av)) - exit(1); + exit(EXIT_FAILURE); av[0] = (char *)user_details.shell; /* plugin may override shell */ if (cmnd != NULL) { @@ -630,7 +630,7 @@ parse_args(int argc, char **argv, int *old_optind, int *nargc, char ***nargv, if (av == NULL) sudo_fatalx(U_("%s: %s"), __func__, U_("unable to allocate memory")); if (!gc_add(GC_PTR, av)) - exit(1); + exit(EXIT_FAILURE); /* Must have the command in argv[0]. */ av[0] = "sudoedit"; @@ -712,7 +712,7 @@ void usage(void) { display_usage(usage_err); - exit(1); + exit(EXIT_FAILURE); } /* @@ -816,5 +816,5 @@ help(void) sudo_lbuf_print(&lbuf); sudo_lbuf_destroy(&lbuf); sudo_debug_exit_int(__func__, __FILE__, __LINE__, sudo_debug_subsys, 0); - exit(0); + exit(EXIT_SUCCESS); } diff --git a/src/regress/noexec/check_noexec.c b/src/regress/noexec/check_noexec.c index e617bb277..bff30f060 100644 --- a/src/regress/noexec/check_noexec.c +++ b/src/regress/noexec/check_noexec.c @@ -184,7 +184,7 @@ main(int argc, char *argv[], char *envp[]) if (argc != 2) { fprintf(stderr, "usage: %s regress | /path/to/sudo_noexec.so\n", getprogname()); - exit(1); + exit(EXIT_FAILURE); } /* Disable execution for post-exec and re-exec ourself. */