Use symbolic constants in exit(2) calls

This commit is contained in:
Michael Kerrisk 2007-05-14 21:11:42 +00:00
parent 19dbfd0a98
commit 4c44ffe5dc
7 changed files with 11 additions and 11 deletions

View File

@ -458,7 +458,7 @@ main(int argc, char **argv)
fprintf(stderr,
"Usage\\n\\tfwd <listen-port> "
"<forward-to-port> <forward-to-ip-address>\\n");
exit(1);
exit(EXIT_FAILURE);
}
signal(SIGPIPE, SIG_IGN);
@ -467,7 +467,7 @@ main(int argc, char **argv)
h = listen_socket(atoi(argv[1]));
if (h < 0)
exit(1);
exit(EXIT_FAILURE);
for (;;) {
int r, nfds = 0;
@ -510,7 +510,7 @@ main(int argc, char **argv)
continue;
if (r < 0) {
perror("select()");
exit(1);
exit(EXIT_FAILURE);
}
if (FD_ISSET(h, &rd)) {
unsigned int l;

View File

@ -377,7 +377,7 @@ main(int argc, char **argv)
handle = dlopen("libm.so", RTLD_LAZY);
if (!handle) {
fprintf(stderr, "%s\en", dlerror());
exit(1);
exit(EXIT_FAILURE);
}
dlerror(); /* Clear any existing error */
@ -386,7 +386,7 @@ main(int argc, char **argv)
*(void **) (&cosine) = dlsym(handle, "cos");
if ((error = dlerror()) != NULL) {
fprintf(stderr, "%s\en", error);
exit(1);
exit(EXIT_FAILURE);
}
printf("%f\en", (*cosine)(2.0));

View File

@ -138,7 +138,7 @@ main(void)
.\" if (i == ENOENT)
.\" break;
.\" printf("getgrent_r: %s", strerror(i));
.\" exit(1);
.\" exit(EXIT_FAILURE);
.\" }
.SH "CONFORMING TO"
These functions are GNU extensions, done in a style resembling

View File

@ -428,7 +428,7 @@ main(int argc, char **argv)
printf("\\n");
}
exit(0);
exit(EXIT_SUCCESS);
}
.fi
.SH BUGS

View File

@ -135,7 +135,7 @@ main(void)
.\" if (i == ENOENT)
.\" break;
.\" printf("getpwent_r: %s", strerror(i));
.\" exit(1);
.\" exit(EXIT_SUCCESS);
.\" }
.SH "CONFORMING TO"
These functions are GNU extensions, done in a style resembling

View File

@ -197,7 +197,7 @@ main(void)
/* there should be no failures */
if (ep == NULL) {
fprintf(stderr, "entry failed\\n");
exit(1);
exit(EXIT_FAILURE);
}
}
for (i = 22; i < 26; i++) {

View File

@ -195,7 +195,7 @@ xmalloc(unsigned n)
if (p)
return p;
fprintf(stderr, "insufficient memory\\n");
exit(1);
exit(EXIT_FAILURE);
}
int
@ -241,7 +241,7 @@ main(void)
*ptr = rand() & 0xff;
val = tsearch((void *) ptr, &root, compare);
if (val == NULL)
exit(1);
exit(EXIT_FAILURE);
}
twalk(root, action);
return 0;