Use EXIT_SUCCESS and EXIT_FAILURE more consistently.

This commit is contained in:
Todd C. Miller
2020-02-08 12:43:00 -07:00
parent c5afbf00fc
commit ac61b5655d
29 changed files with 58 additions and 58 deletions

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}
/*

View File

@@ -41,7 +41,7 @@ static void
usage(void)
{
fprintf(stderr, "usage: %s plugin.so symbols_file\n", getprogname());
exit(1);
exit(EXIT_FAILURE);
}
int

View File

@@ -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);
}
}

View File

@@ -52,7 +52,7 @@ static void
usage(void)
{
fprintf(stderr, "usage: %s pathname\n", getprogname());
exit(1);
exit(EXIT_FAILURE);
}
static int

View File

@@ -44,7 +44,7 @@ static void
usage(void)
{
fprintf(stderr, "usage: %s inputfile\n", getprogname());
exit(1);
exit(EXIT_FAILURE);
}
int

View File

@@ -77,7 +77,7 @@ static void
usage(void)
{
fprintf(stderr, "usage: %s datafile\n", getprogname());
exit(1);
exit(EXIT_FAILURE);
}
int

View File

@@ -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);
}
/*

View File

@@ -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] <user> <command> [args]\n", getprogname());
exit(1);
exit(EXIT_FAILURE);
}

View File

@@ -314,5 +314,5 @@ usage(void)
{
fprintf(stderr, "usage: %s [-f timestamp_file] | [-u username]\n",
getprogname());
exit(1);
exit(EXIT_FAILURE);
}

View File

@@ -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);
}