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

@@ -56,5 +56,5 @@ main(int argc, char *argv[])
}
printf("};\n");
exit(0);
exit(EXIT_SUCCESS);
}

View File

@@ -56,5 +56,5 @@ main(int argc, char *argv[])
}
printf("};\n");
exit(0);
exit(EXIT_SUCCESS);
}

View File

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

View File

@@ -87,7 +87,7 @@ runtests(char **buf, size_t *buflen)
sudo_warn_nodebug("send");
_exit(127);
}
_exit(0);
_exit(EXIT_SUCCESS);
break;
default:
/* parent */

View File

@@ -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++)

View File

@@ -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",

View File

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

View File

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