diff --git a/ChangeLog b/ChangeLog index 4a827094..f8c3aa7e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,48 @@ +2010-08-19 Alfred M. Szmidt + + Use EXIT_SUCCESS and EXIT_FAILURE macros through out. + + * cfg.mk (local-checks-to-skip): Removed sc_prohibit_magic_number_exit from list. + + * whois/whois.c (main, err_sys, err_quit): Don't use magical exit numbers. + * telnetd/utility.c (io_drain, fatal): Likewise. + * telnetd/telnetd.c (main, telnetd_setup): Likewise. + * telnetd/state.c (telrcv): Likewise. + * telnetd/pty.c (startslave, cleanup): Likewise. + * telnet/terminal.c (init_terminal): Likewise. + * telnet/network.c (init_network): Likewise. + * telnet/main.c (main): Likewise. + * talkd/talkd.c (talkd_init, alarm_handler): Likewise. + * talkd/table.c (insert_table): Likewise. + * talkd/announce.c (announce): Likewise. + * talkd/acl.c (netdef_parse, read_acl): Likewise. + * talk/init_disp.c (init_display, quit): Likewise. + * src/uucpd.c (main): Likewise. + * src/traceroute.c (main): Likewise. + * src/tftpd.c (main, tftp, timer, justquit): Likewise. + * src/tftp.c (main, command, quit): Likewise. + * src/syslogd.c (main, add_funix, crunch_list, die): Likewise. + * src/rshd.c (main, doit, getstr): Likewise. + * src/rsh.c (main, else, sigmask, talk, copyargs): Likewise. + * src/rlogind.c (main, rlogin_daemon, rlogind_auth) + (rlogind_mainloop, getstr, cleanup, fatal): Likewise. + * src/rlogin.c (main): Likewise. + * src/rexecd.c (main, doit): Likewise. + * src/rexec.c (main): Likewise. + * src/rcp.c (main, toremote, sink): Likewise. + * src/logger.c (main): Likewise. + * src/inetd.c (echo_stream, discard_stream, chargen_stream) + (tcpmux, main): Likewise. + * ping/ping.c (main): Likewise. + * libtelnet/auth.c (auth_send): Likewise. + * libls/util.c (usage): Likewise. + * libls/ls.c (traverse, display): Likewise. + * ifconfig/ifconfig.c (main): Likewise. + * ftpd/ftpd.c (main, pass): Likewise. + * ftp/cmds.c (fatal): Likewise. + * libinetutils/daemon.c: Include . + (waitdaemon_timeout): Don't use magical exit numbers. + 2010-08-19 Alfred M. Szmidt Only include if it is used. diff --git a/cfg.mk b/cfg.mk index fbf8b430..419b8c8a 100644 --- a/cfg.mk +++ b/cfg.mk @@ -27,7 +27,6 @@ local-checks-to-skip = \ sc_m4_quote_check \ sc_program_name \ sc_prohibit_atoi_atof \ - sc_prohibit_magic_number_exit \ sc_prohibit_stat_st_blocks \ sc_prohibit_strcmp \ sc_unmarked_diagnostics \ diff --git a/ftp/cmds.c b/ftp/cmds.c index 5bff79a2..65d47e94 100644 --- a/ftp/cmds.c +++ b/ftp/cmds.c @@ -1931,7 +1931,7 @@ fatal (msg) char *msg; { - error (1, 0, "%s", msg); + error (EXIT_FAILURE, 0, "%s", msg); } /* diff --git a/ftpd/ftpd.c b/ftpd/ftpd.c index 729951a7..22c75f9a 100644 --- a/ftpd/ftpd.c +++ b/ftpd/ftpd.c @@ -426,7 +426,7 @@ main (int argc, char *argv[], char **envp) /* Bail out, wrong usage */ argc -= index; if (argc != 0) - error (1, 0, "surplus arguments; try `%s --help' for more info", + error (EXIT_FAILURE, 0, "surplus arguments; try `%s --help' for more info", program_name); /* LOG_NDELAY sets up the logging connection immediately, @@ -439,7 +439,7 @@ main (int argc, char *argv[], char **envp) if (daemon_mode) { if (server_mode (pid_file, &his_addr) < 0) - exit (1); + exit (EXIT_FAILURE); } else { @@ -448,7 +448,7 @@ main (int argc, char *argv[], char **envp) &addrlen) < 0) { syslog (LOG_ERR, "getpeername (%s): %m", program_name); - exit (1); + exit (EXIT_FAILURE); } } @@ -468,7 +468,7 @@ main (int argc, char *argv[], char **envp) &addrlen) < 0) { syslog (LOG_ERR, "getsockname (%s): %m", program_name); - exit (1); + exit (EXIT_FAILURE); } } @@ -513,7 +513,7 @@ main (int argc, char *argv[], char **envp) if (display_file (PATH_NOLOGIN, 530) == 0) { reply (530, "System not available."); - exit (0); + exit (EXIT_SUCCESS); } /* Display a Welcome message if exists, @@ -819,7 +819,7 @@ pass (const char *passwd) { syslog (LOG_NOTICE, "repeated login failures from %s", cred.remotehost); - exit (0); + exit (EXIT_SUCCESS); } return; } diff --git a/ifconfig/ifconfig.c b/ifconfig/ifconfig.c index 222a9d68..e3300615 100644 --- a/ifconfig/ifconfig.c +++ b/ifconfig/ifconfig.c @@ -58,7 +58,7 @@ main (int argc, char *argv[]) if (sfd < 0) { error (0, errno, "socket error"); - exit (1); + exit (EXIT_FAILURE); } for (ifp = ifs; ifp < ifs + nifs; ifp++) diff --git a/libinetutils/daemon.c b/libinetutils/daemon.c index a6834e01..3d22f721 100644 --- a/libinetutils/daemon.c +++ b/libinetutils/daemon.c @@ -51,6 +51,7 @@ #include #include #include +#include #ifdef HAVE_SYS_TYPES_H # include #endif @@ -110,7 +111,7 @@ waitdaemon_timeout (int signo) left = alarm (0); signal (SIGALRM, SIG_DFL); if (left == 0) - error (1, 0, "timed out waiting for child"); + error (EXIT_FAILURE, 0, "timed out waiting for child"); } /* waitdaemon is like daemon, but optionally the parent pause up diff --git a/libls/ls.c b/libls/ls.c index e7893bb7..5d5e7cda 100644 --- a/libls/ls.c +++ b/libls/ls.c @@ -364,7 +364,7 @@ traverse (argc, argv, options) if ((ftsp = fts_open (argv, options, f_nosort ? NULL : mastercmp)) == NULL) { fprintf (stderr, "%s: fts_open: %s", argv[0], strerror (errno)); - exit (1); + exit (EXIT_FAILURE); } display (NULL, fts_children (ftsp, 0)); @@ -416,7 +416,7 @@ traverse (argc, argv, options) if (errno) { fprintf (stderr, "fts_read: %s", strerror (errno)); - exit (1); + exit (EXIT_FAILURE); } } @@ -540,7 +540,7 @@ display (p, list) ulen + glen + flen + 3)) == NULL) { fprintf (stderr, "malloc: %s", strerror (errno)); - exit (1); + exit (EXIT_FAILURE); } np->user = &np->data[0]; diff --git a/libls/util.c b/libls/util.c index 59422266..fc74a902 100644 --- a/libls/util.c +++ b/libls/util.c @@ -77,5 +77,5 @@ void usage () { fprintf (stderr, "usage: ls [-1ACFLRSTWacdfiklmnopqrstux] [file ...]\n"); - exit (1); + exit (EXIT_FAILURE); } diff --git a/libtelnet/auth.c b/libtelnet/auth.c index d4b201b8..8a86132d 100644 --- a/libtelnet/auth.c +++ b/libtelnet/auth.c @@ -537,7 +537,7 @@ auth_send (unsigned char *data, int cnt) * Therefore, exit on client end. */ printf ("Unable to securely authenticate user ... exit\n"); - exit (0); + exit (EXIT_SUCCESS); # endif /* KANNAN */ } diff --git a/ping/ping.c b/ping/ping.c index ffab7474..607f10db 100644 --- a/ping/ping.c +++ b/ping/ping.c @@ -248,7 +248,7 @@ main (int argc, char **argv) ping = ping_init (ICMP_ECHO, getpid ()); if (ping == NULL) /* ping_init() prints our error message. */ - exit (1); + exit (EXIT_FAILURE); ping_set_sockopt (ping, SO_BROADCAST, (char *) &one, sizeof (one)); diff --git a/ping/ping6.c b/ping/ping6.c index a71a32e0..c4f8742e 100644 --- a/ping/ping6.c +++ b/ping/ping6.c @@ -187,7 +187,7 @@ main (int argc, char **argv) ping = ping_init (0, getpid ()); if (ping == NULL) /* ping_init() prints our error message. */ - exit (1); + exit (EXIT_FAILURE); setsockopt (ping->ping_fd, SOL_SOCKET, SO_BROADCAST, (char *) &one, sizeof (one)); diff --git a/src/inetd.c b/src/inetd.c index ff8d5a7e..e8e5c8b8 100644 --- a/src/inetd.c +++ b/src/inetd.c @@ -1359,7 +1359,7 @@ echo_stream (int s, struct servtab *sep) while ((i = read (s, buffer, sizeof buffer)) > 0 && write (s, buffer, i) > 0) ; - exit (0); + exit (EXIT_SUCCESS); } /* Echo service -- echo data back */ @@ -1397,7 +1397,7 @@ discard_stream (int s, struct servtab *sep) if (ret == 0 || errno != EINTR) break; } - exit (0); + exit (EXIT_SUCCESS); } void @@ -1457,7 +1457,7 @@ chargen_stream (int s, struct servtab *sep) if (write (s, text, sizeof text) != sizeof text) break; } - exit (0); + exit (EXIT_SUCCESS); } /* Character generator */ @@ -1669,7 +1669,7 @@ tcpmux (int s, struct servtab *sep) } } strwrite (s, "-Service not available\r\n"); - exit (1); + exit (EXIT_FAILURE); } /* Set TCP environment variables, modelled after djb's ucspi-tcp tools: diff --git a/src/logger.c b/src/logger.c index 2afda3b1..3c2d0157 100644 --- a/src/logger.c +++ b/src/logger.c @@ -371,5 +371,5 @@ main (int argc, char *argv[]) send_to_syslog (buf); } free (buf); - exit (0); + exit (EXIT_SUCCESS); } diff --git a/src/rcp.c b/src/rcp.c index 74b036d1..cfd370c2 100644 --- a/src/rcp.c +++ b/src/rcp.c @@ -280,11 +280,11 @@ main (int argc, char *argv[]) sp = getservbyname (shell = "shell", "tcp"); #endif if (sp == NULL) - error (1, 0, "%s/tcp: unknown service", shell); + error (EXIT_FAILURE, 0, "%s/tcp: unknown service", shell); port = sp->s_port; if ((pwd = getpwuid (userid = getuid ())) == NULL) - error (1, 0, "unknown user %d", (int) userid); + error (EXIT_FAILURE, 0, "unknown user %d", (int) userid); rem = STDIN_FILENO; /* XXX */ @@ -304,7 +304,7 @@ main (int argc, char *argv[]) } if (argc < 2) - error (1, 0, "not enough arguments"); + error (EXIT_FAILURE, 0, "not enough arguments"); if (argc > 2) targetshouldbedirectory = 1; @@ -361,7 +361,7 @@ toremote (char *targ, int argc, char *argv[]) if (*tuser == '\0') tuser = NULL; else if (!okname (tuser)) - exit (1); + exit (EXIT_FAILURE); } else { @@ -422,7 +422,7 @@ toremote (char *targ, int argc, char *argv[]) rem = rcmd (&host, port, pwd->pw_name, tuser ? tuser : pwd->pw_name, bp, 0); if (rem < 0) - exit (1); + exit (EXIT_FAILURE); #if defined (IP_TOS) && defined (IPPROTO_IP) && defined (IPTOS_THROUGHPUT) tos = IPTOS_THROUGHPUT; if (setsockopt (rem, IPPROTO_IP, IP_TOS, @@ -430,7 +430,7 @@ toremote (char *targ, int argc, char *argv[]) error (0, errno, "TOS (ignored)"); #endif if (response () < 0) - exit (1); + exit (EXIT_FAILURE); free (bp); setuid (userid); } @@ -726,7 +726,7 @@ sink (int argc, char *argv[]) if (argc != 1) { run_err ("ambiguous target"); - exit (1); + exit (EXIT_FAILURE); } targ = *argv; if (targetshouldbedirectory) @@ -755,7 +755,7 @@ sink (int argc, char *argv[]) if (iamremote == 0) write (STDERR_FILENO, buf + 1, strlen (buf + 1)); if (buf[0] == '\02') - exit (1); + exit (EXIT_FAILURE); ++errs; continue; } @@ -801,7 +801,7 @@ sink (int argc, char *argv[]) if (first) { run_err ("%s", cp); - exit (1); + exit (EXIT_FAILURE); } SCREWUP ("expected control record"); } @@ -906,7 +906,7 @@ sink (int argc, char *argv[]) if (j <= 0) { run_err ("%s", j ? strerror (errno) : "dropped connection"); - exit (1); + exit (EXIT_FAILURE); } amt -= j; cp += j; @@ -988,7 +988,7 @@ sink (int argc, char *argv[]) } screwup: run_err ("protocol error: %s", why); - exit (1); + exit (EXIT_FAILURE); } #ifdef KERBEROS @@ -1015,7 +1015,7 @@ again: { use_kerberos = 0; if ((sp = getservbyname ("shell", "tcp")) == NULL) - error (1, 0, "unknown service shell/tcp"); + error (EXIT_FAILURE, 0, "unknown service shell/tcp"); if (errno == ECONNREFUSED) oldw ("remote host doesn't support Kerberos"); else if (errno == ENOENT) @@ -1028,7 +1028,7 @@ again: { # ifdef CRYPT if (doencrypt) - error (1, 0, "the -x option requires Kerberos authentication"); + error (EXIT_FAILURE, 0, "the -x option requires Kerberos authentication"); # endif rem = rcmd (host, port, locuser, user, bp, 0); } @@ -1067,7 +1067,7 @@ response () ++errs; if (resp == 1) return -1; - exit (1); + exit (EXIT_FAILURE); } } @@ -1140,7 +1140,7 @@ verifydir (char *cp) errno = ENOTDIR; } run_err ("%s: %s", cp, strerror (errno)); - exit (1); + exit (EXIT_FAILURE); } int @@ -1227,5 +1227,5 @@ lostconn (int signo) { if (!iamremote) error (0, 0, "lost connection"); - exit (1); + exit (EXIT_FAILURE); } diff --git a/src/rexec.c b/src/rexec.c index 382bf38b..37b6ef85 100644 --- a/src/rexec.c +++ b/src/rexec.c @@ -163,7 +163,7 @@ main (int argc, char **argv) do_rexec (&arguments); - exit (0); + exit (EXIT_SUCCESS); } static void diff --git a/src/rexecd.c b/src/rexecd.c index d5467a73..03960eac 100644 --- a/src/rexecd.c +++ b/src/rexecd.c @@ -124,7 +124,7 @@ main (int argc, char **argv) if (getpeername (sockfd, (struct sockaddr *) &from, &fromlen) < 0) error (EXIT_FAILURE, errno, "getpeername"); doit (sockfd, &from); - exit (0); + exit (EXIT_SUCCESS); } char username[20] = "USER="; @@ -194,7 +194,7 @@ doit (int f, struct sockaddr_in *fromp) { char c; if (read (f, &c, 1) != 1) - exit (1); + exit (EXIT_FAILURE); if (c == 0) break; port = port * 10 + c - '0'; @@ -204,13 +204,13 @@ doit (int f, struct sockaddr_in *fromp) { s = socket (AF_INET, SOCK_STREAM, 0); if (s < 0) - exit (1); + exit (EXIT_FAILURE); if (bind (s, (struct sockaddr *) &a_sin, sizeof (a_sin)) < 0) - exit (1); + exit (EXIT_FAILURE); alarm (60); fromp->sin_port = htons (port); if (connect (s, (struct sockaddr *) fromp, sizeof (*fromp)) < 0) - exit (1); + exit (EXIT_FAILURE); alarm (0); } @@ -280,7 +280,7 @@ doit (int f, struct sockaddr_in *fromp) } } while (FD_ISSET (pv[0], &readfrom) || FD_ISSET (s, &readfrom)); - exit (0); + exit (EXIT_SUCCESS); } setpgid (0, getpid ()); close (s); diff --git a/src/rlogin.c b/src/rlogin.c index e87fe006..26c5b204 100644 --- a/src/rlogin.c +++ b/src/rlogin.c @@ -347,11 +347,11 @@ main (int argc, char *argv[]) /* We must be uid root to access rcmd(). */ if (geteuid ()) - error (1, 0, "must be setuid root.\n"); + error (EXIT_FAILURE, 0, "must be setuid root.\n"); /* Get the name of the user invoking us: the client-user-name. */ if (!(pw = getpwuid (uid = getuid ()))) - error (1, 0, "unknown user id."); + error (EXIT_FAILURE, 0, "unknown user id."); /* Accept user1@host format, though "-l user2" overrides user1 */ { @@ -385,7 +385,7 @@ main (int argc, char *argv[]) if (sp == NULL) sp = getservbyname ("login", "tcp"); if (sp == NULL) - error (1, 0, "login/tcp: unknown service."); + error (EXIT_FAILURE, 0, "login/tcp: unknown service."); /* Get the name of the terminal from the environment. Also get the terminal's spee. Both the name and the spee are passed to the server @@ -434,7 +434,7 @@ try_connect: /* Fully qualify hostname (needed for krb_realmofhost). */ hp = gethostbyname (host); if (hp != NULL && !(host = strdup (hp->h_name))) - error (1, errno, "strdup"); + error (EXIT_FAILURE, errno, "strdup"); # if defined (KERBEROS) rem = KSUCCESS; @@ -522,7 +522,7 @@ try_connect: use_kerberos = 0; sp = getservbyname ("login", "tcp"); if (sp == NULL) - error (1, 0, "unknown service login/tcp."); + error (EXIT_FAILURE, 0, "unknown service login/tcp."); if (errno == ECONNREFUSED) warning ("remote host doesn't support Kerberos"); if (errno == ENOENT) @@ -535,7 +535,7 @@ try_connect: { # ifdef ENCRYPTION if (doencrypt) - error (1, 0, "the -x flag requires Kerberos authentication."); + error (EXIT_FAILURE, 0, "the -x flag requires Kerberos authentication."); # endif /* CRYPT */ if (!user) user = pw->pw_name; @@ -551,7 +551,7 @@ try_connect: #endif /* KERBEROS */ if (rem < 0) - exit (1); + exit (EXIT_FAILURE); { int one = 1; diff --git a/src/rlogind.c b/src/rlogind.c index 065fef9a..518f288c 100644 --- a/src/rlogind.c +++ b/src/rlogind.c @@ -377,7 +377,7 @@ main (int argc, char *argv[]) if (argc > 0) { syslog (LOG_ERR, "%d extra arguments", argc); - exit (1); + exit (EXIT_FAILURE); } signal (SIGHUP, SIG_IGN); @@ -389,7 +389,7 @@ main (int argc, char *argv[]) if (!p) { syslog (LOG_ERR, "can't determine local hostname"); - exit (1); + exit (EXIT_FAILURE); } local_dot_count = 2; local_domain_name = topdomain (p, local_dot_count); @@ -448,7 +448,7 @@ rlogin_daemon (int maxchildren, int port) if (listenfd == -1) { syslog (LOG_ERR, "socket: %s", strerror (errno)); - exit (1); + exit (EXIT_FAILURE); } { @@ -467,13 +467,13 @@ rlogin_daemon (int maxchildren, int port) if (bind (listenfd, (struct sockaddr *) &saddr, size) == -1) { syslog (LOG_ERR, "bind: %s", strerror (errno)); - exit (1); + exit (EXIT_FAILURE); } if (listen (listenfd, 128) == -1) { syslog (LOG_ERR, "listen: %s", strerror (errno)); - exit (1); + exit (EXIT_FAILURE); } while (1) @@ -493,7 +493,7 @@ rlogin_daemon (int maxchildren, int port) if (errno == EINTR) continue; syslog (LOG_ERR, "accept: %s", strerror (errno)); - exit (1); + exit (EXIT_FAILURE); } pid = fork (); @@ -531,7 +531,7 @@ rlogind_auth (int fd, struct auth_data *ap) else if (reverse_required) { syslog (LOG_CRIT, "can't resolve remote IP address"); - exit (1); + exit (EXIT_FAILURE); } else hostname = inet_ntoa (ap->from.sin_addr); @@ -604,7 +604,7 @@ rlogind_auth (int fd, struct auth_data *ap) if (setsockopt (0, ipproto, IP_OPTIONS, (char *) NULL, optsize)) { syslog (LOG_ERR, "setsockopt IP_OPTIONS NULL: %m"); - exit (1); + exit (EXIT_FAILURE); } } } @@ -742,7 +742,7 @@ rlogind_mainloop (int infd, int outfd) if (read (infd, &c, 1) != 1 || c != 0) { syslog (LOG_CRIT, "protocol error: expected 0 byte"); - exit (1); + exit (EXIT_FAILURE); } alarm (0); @@ -1219,7 +1219,7 @@ getstr (int infd, char **ptr, const char *prefix) if (!buf) { syslog (LOG_ERR, "not enough memory"); - exit (1); + exit (EXIT_FAILURE); } pos = 0; @@ -1234,7 +1234,7 @@ getstr (int infd, char **ptr, const char *prefix) if (read (infd, &c, 1) != 1) { syslog (LOG_ERR, "read error: %m"); - exit (1); + exit (EXIT_FAILURE); } if (pos == size) { @@ -1243,7 +1243,7 @@ getstr (int infd, char **ptr, const char *prefix) if (!buf) { syslog (LOG_ERR, "not enough memory"); - exit (1); + exit (EXIT_FAILURE); } } buf[pos++] = c; @@ -1495,7 +1495,7 @@ cleanup (int signo ARG_UNUSED) chown (line, 0, 0); #endif shutdown (netf, 2); - exit (1); + exit (EXIT_FAILURE); } int @@ -1539,5 +1539,5 @@ fatal (int f, const char *msg, int syserr) snprintf (bp, sizeof buf - (bp - buf), "rlogind: %s.\r\n", msg); len = strlen (bp); write (f, buf, bp + len - buf); - exit (1); + exit (EXIT_FAILURE); } diff --git a/src/rsh.c b/src/rsh.c index 4f019303..23cc11e6 100644 --- a/src/rsh.c +++ b/src/rsh.c @@ -239,7 +239,7 @@ main (int argc, char **argv) /* To few args. */ if (!host) - error (1, 0, "host not specified"); + error (EXIT_FAILURE, 0, "host not specified"); /* If no further arguments, must have been called as rlogin. */ if (!argv[index]) @@ -249,7 +249,7 @@ main (int argc, char **argv) seteuid (getuid ()); setuid (getuid ()); execv (PATH_RLOGIN, argv); - error (1, errno, "cannot execute %s", PATH_RLOGIN); + error (EXIT_FAILURE, errno, "cannot execute %s", PATH_RLOGIN); } argc -= index; @@ -257,10 +257,10 @@ main (int argc, char **argv) /* We must be setuid root. */ if (geteuid ()) - error (1, 0, "must be setuid root.\n"); + error (EXIT_FAILURE, 0, "must be setuid root.\n"); if (!(pw = getpwuid (uid = getuid ()))) - error (1, 0, "unknown user id"); + error (EXIT_FAILURE, 0, "unknown user id"); /* Accept user1@host format, though "-l user2" overrides user1 */ { @@ -272,7 +272,7 @@ main (int argc, char **argv) user = host; host = p + 1; if (*host == '\0') - error (1, 0, "empty host name"); + error (EXIT_FAILURE, 0, "empty host name"); } } @@ -312,7 +312,7 @@ main (int argc, char **argv) if (sp == NULL) sp = getservbyname ("shell", "tcp"); if (sp == NULL) - error (1, 0, "shell/tcp: unknown service"); + error (EXIT_FAILURE, 0, "shell/tcp: unknown service"); #if defined (KERBEROS) || defined(SHISHI) @@ -324,7 +324,7 @@ try_connect: /* fully qualify hostname (needed for krb_realmofhost) */ hp = gethostbyname (host); if (hp != NULL && !(host = strdup (hp->h_name))) - error (1, errno, "strdup"); + error (EXIT_FAILURE, errno, "strdup"); # if defined (KERBEROS) rem = KSUCCESS; @@ -420,7 +420,7 @@ try_connect: use_kerberos = 0; sp = getservbyname ("shell", "tcp"); if (sp == NULL) - error (1, 0, "shell/tcp: unknown service"); + error (EXIT_FAILURE, 0, "shell/tcp: unknown service"); if (errno == ECONNREFUSED) warning ("remote host doesn't support Kerberos"); if (errno == ENOENT) @@ -433,7 +433,7 @@ try_connect: if (!user) user = pw->pw_name; if (doencrypt) - error (1, 0, "the -x flag requires Kerberos authentication"); + error (EXIT_FAILURE, 0, "the -x flag requires Kerberos authentication"); rem = rcmd (&host, sp->s_port, pw->pw_name, user, args, &rfd2); } #else @@ -443,10 +443,10 @@ try_connect: #endif if (rem < 0) - exit (1); + exit (EXIT_FAILURE); if (rfd2 < 0) - error (1, 0, "can't establish stderr"); + error (EXIT_FAILURE, 0, "can't establish stderr"); if (debug_option) { @@ -482,7 +482,7 @@ try_connect: { pid = fork (); if (pid < 0) - error (1, errno, "fork"); + error (EXIT_FAILURE, errno, "fork"); } #if defined(KERBEROS) || defined(SHISHI) @@ -546,7 +546,7 @@ talk (int null_input_option, sigset_t * osigs, pid_t pid, int rem) if (select (rem + 1, 0, &rembits, 0, 0) < 0) { if (errno != EINTR) - error (1, errno, "select"); + error (EXIT_FAILURE, errno, "select"); goto rewrite; } if (!FD_ISSET (rem, &rembits)) @@ -576,7 +576,7 @@ talk (int null_input_option, sigset_t * osigs, pid_t pid, int rem) goto rewrite; done: shutdown (rem, 1); - exit (0); + exit (EXIT_SUCCESS); } #ifdef HAVE_SIGACTION @@ -596,7 +596,7 @@ talk (int null_input_option, sigset_t * osigs, pid_t pid, int rem) if (select (maxfd + 1, &ready, 0, 0, 0) < 0) { if (errno != EINTR) - error (1, errno, "select"); + error (EXIT_FAILURE, errno, "select"); continue; } if (FD_ISSET (rfd2, &ready)) @@ -699,7 +699,7 @@ copyargs (char **argv) for (ap = argv; *ap; ++ap) cc += strlen (*ap) + 1; if (!(args = malloc ((u_int) cc))) - error (1, errno, "copyargs"); + error (EXIT_FAILURE, errno, "copyargs"); for (p = args, ap = argv; *ap; ++ap) { strcpy (p, *ap); diff --git a/src/rshd.c b/src/rshd.c index 3c03a676..78cfb162 100644 --- a/src/rshd.c +++ b/src/rshd.c @@ -222,20 +222,20 @@ main (int argc, char *argv[]) if (argc > 0) { syslog (LOG_ERR, "%d extra arguments", argc); - exit (1); + exit (EXIT_FAILURE); } #if defined(KERBEROS) || defined(SHISHI) if (use_kerberos && vacuous) { syslog (LOG_ERR, "only one of -k and -v allowed"); - exit (2); + exit (EXIT_FAILURE); } # ifdef ENCRYPTION if (doencrypt && !use_kerberos) { syslog (LOG_ERR, "-k is required for -x"); - exit (2); + exit (EXIT_FAILURE); } # endif #endif @@ -333,7 +333,7 @@ doit (int sockfd, struct sockaddr_in *fromp) { syslog (LOG_ERR, "malformed \"from\" address (af %d)\n", fromp->sin_family); - exit (1); + exit (EXIT_FAILURE); } #ifdef IP_OPTIONS { @@ -365,7 +365,7 @@ doit (int sockfd, struct sockaddr_in *fromp) (char *) NULL, optsize) != 0) { syslog (LOG_ERR, "setsockopt IP_OPTIONS NULL: %m"); - exit (1); + exit (EXIT_FAILURE); } } } @@ -383,7 +383,7 @@ doit (int sockfd, struct sockaddr_in *fromp) syslog (LOG_NOTICE | LOG_AUTH, "Connection from %s on illegal port %u", inet_ntoa (fromp->sin_addr), fromp->sin_port); - exit (1); + exit (EXIT_FAILURE); } /* Read the ASCII string specifying the secondary port# from @@ -401,7 +401,7 @@ doit (int sockfd, struct sockaddr_in *fromp) if (cc < 0) syslog (LOG_NOTICE, "read: %m"); shutdown (sockfd, 2); - exit (1); + exit (EXIT_FAILURE); } /* null byte terminates the string */ if (c == 0) @@ -425,7 +425,7 @@ doit (int sockfd, struct sockaddr_in *fromp) if (s < 0) { syslog (LOG_ERR, "can't get stderr port: %m"); - exit (1); + exit (EXIT_FAILURE); } #if defined(KERBEROS) || defined(SHISHI) if (!use_kerberos) @@ -433,7 +433,7 @@ doit (int sockfd, struct sockaddr_in *fromp) if (port >= IPPORT_RESERVED || port < IPPORT_RESERVED / 2) { syslog (LOG_ERR, "2nd port not reserved\n"); - exit (1); + exit (EXIT_FAILURE); } /* Use the fromp structure taht we already have. * The 32-bit Internet address is obviously that of the @@ -446,7 +446,7 @@ doit (int sockfd, struct sockaddr_in *fromp) if (connect (s, (struct sockaddr *) fromp, sizeof (*fromp)) < 0) { syslog (LOG_INFO, "connect second port %d: %m", port); - exit (1); + exit (EXIT_FAILURE); } } @@ -454,7 +454,7 @@ doit (int sockfd, struct sockaddr_in *fromp) if (vacuous) { rshd_error ("rshd: remote host requires Kerberos authentication\n"); - exit (1); + exit (EXIT_FAILURE); } #endif @@ -546,7 +546,7 @@ doit (int sockfd, struct sockaddr_in *fromp) { syslog (LOG_ERR, "getsockname: %m"); rshd_error ("rlogind: getsockname: %s", strerror (errno)); - exit (1); + exit (EXIT_FAILURE); } authopts = KOPT_DO_MUTUAL; rc = krb_recvauth (authopts, 0, ticket, @@ -564,7 +564,7 @@ doit (int sockfd, struct sockaddr_in *fromp) { rshd_error ("Kerberos authentication failure: %s\n", krb_err_txt[rc]); - exit (1); + exit (EXIT_FAILURE); } } else @@ -580,7 +580,7 @@ doit (int sockfd, struct sockaddr_in *fromp) { rshd_error ("Kerberos authentication failure: %s\n", err_msg ? err_msg : shishi_strerror (rc)); - exit (1); + exit (EXIT_FAILURE); } } else @@ -665,7 +665,7 @@ doit (int sockfd, struct sockaddr_in *fromp) remuser = getstr ("remuser"); rc = read (STDIN_FILENO, &error, sizeof (int)); if ((rc != sizeof (int)) && rc) - exit (1); + exit (EXIT_FAILURE); /* verify checksum */ @@ -673,7 +673,7 @@ doit (int sockfd, struct sockaddr_in *fromp) if (getsockname (STDIN_FILENO, (struct sockaddr *)&sock, &socklen) < 0) { syslog (LOG_ERR, "Can't get sock name"); - exit (1); + exit (EXIT_FAILURE); } */ snprintf (cksumdata, 100, "544:%s%s", /*ntohs(sock.sin_port), */ cmdbuf, @@ -690,7 +690,7 @@ doit (int sockfd, struct sockaddr_in *fromp) /* *err_msg = "checksum verify failed"; */ syslog (LOG_ERR, "checksum verify failed: %s", shishi_error (h)); free (compcksum); - exit (1); + exit (EXIT_FAILURE); } rc = shishi_authorized_p (h, shishi_ap_tkt (ap), locuser); @@ -698,7 +698,7 @@ doit (int sockfd, struct sockaddr_in *fromp) { syslog (LOG_ERR, "User is not authorized to log in as: %s", locuser); shishi_ap_done (ap); - exit (1); + exit (EXIT_FAILURE); } free (compcksum); @@ -732,7 +732,7 @@ doit (int sockfd, struct sockaddr_in *fromp) syslog (LOG_INFO | LOG_AUTH, "Kerberos rsh denied to %s.%s@%s", kdata->pname, kdata->pinst, kdata->prealm); rshd_error ("Permission denied.\n"); - exit (1); + exit (EXIT_FAILURE); } } } @@ -747,7 +747,7 @@ doit (int sockfd, struct sockaddr_in *fromp) syslog (LOG_INFO|LOG_AUTH, "Kerberos rsh denied to %s.%s@%s", kdata->pname, kdata->pinst, kdata->prealm); rshd_error ("Permission denied.\n"); - exit (1); + exit (EXIT_FAILURE); } } */ } @@ -769,14 +769,14 @@ doit (int sockfd, struct sockaddr_in *fromp) if (errorstr == NULL) errorstr = "Permission denied.\n"; rshd_error (errorstr, errorhost); - exit (1); + exit (EXIT_FAILURE); } /* If the locuser isn't root, then check if logins are disabled. */ if (pwd->pw_uid && !access (PATH_NOLOGIN, F_OK)) { rshd_error ("Logins currently disabled.\n"); - exit (1); + exit (EXIT_FAILURE); } /* Now write the null byte back to the client telling it @@ -789,7 +789,7 @@ doit (int sockfd, struct sockaddr_in *fromp) if (write (STDERR_FILENO, "\0", 1) < 0) { rshd_error ("Lost connection.\n"); - exit (1); + exit (EXIT_FAILURE); } sent_null = 1; @@ -804,7 +804,7 @@ doit (int sockfd, struct sockaddr_in *fromp) if (pipe (pv) < 0) { rshd_error ("Can't make pipe.\n"); - exit (1); + exit (EXIT_FAILURE); } #ifdef ENCRYPTION # if defined(KERBEROS) || defined(SHISHI) @@ -813,12 +813,12 @@ doit (int sockfd, struct sockaddr_in *fromp) if (pipe (pv1) < 0) { rshd_error ("Can't make 2nd pipe.\n"); - exit (1); + exit (EXIT_FAILURE); } if (pipe (pv2) < 0) { rshd_error ("Can't make 3rd pipe.\n"); - exit (1); + exit (EXIT_FAILURE); } } # endif @@ -827,7 +827,7 @@ doit (int sockfd, struct sockaddr_in *fromp) if (pid == -1) { rshd_error ("Can't fork; try again.\n"); - exit (1); + exit (EXIT_FAILURE); } if (pid) { @@ -1007,7 +1007,7 @@ doit (int sockfd, struct sockaddr_in *fromp) * terminates. The socket will terninate whe the * client process terminates. */ - exit (0); + exit (EXIT_SUCCESS); } /* Child process. Become a process group leader, so that @@ -1119,7 +1119,7 @@ doit (int sockfd, struct sockaddr_in *fromp) else #endif execl (pwd->pw_shell, cp, "-c", cmdbuf, NULL); - error (1, errno, "cannot execute %s", pwd->pw_shell); + error (EXIT_FAILURE, errno, "cannot execute %s", pwd->pw_shell); } /* @@ -1157,7 +1157,7 @@ getstr (const char *err) if (!buf) { rshd_error ("Out of space reading %s\n", err); - exit (1); + exit (EXIT_FAILURE); } do @@ -1170,7 +1170,7 @@ getstr (const char *err) rshd_error ("EOF reading %s\n", err); else perror (err); - exit (1); + exit (EXIT_FAILURE); } end += rd; @@ -1183,7 +1183,7 @@ getstr (const char *err) if (!buf) { rshd_error ("Out of space reading %s\n", err); - exit (1); + exit (EXIT_FAILURE); } end = buf + end_offs; } diff --git a/src/syslogd.c b/src/syslogd.c index 4147a390..5638fb5a 100644 --- a/src/syslogd.c +++ b/src/syslogd.c @@ -450,7 +450,7 @@ main (int argc, char *argv[]) signal (SIGTERM, doexit); ppid = waitdaemon (0, 0, 30); if (ppid < 0) - error (1, errno, "could not become daemon"); + error (EXIT_FAILURE, errno, "could not become daemon"); } else { @@ -461,7 +461,7 @@ main (int argc, char *argv[]) /* Get our hostname. */ LocalHostName = localhost (); if (LocalHostName == NULL) - error (2, errno, "can't get local host name"); + error (EXIT_FAILURE, errno, "can't get local host name"); /* Get the domainname. */ p = strchr (LocalHostName, '.'); @@ -505,7 +505,7 @@ main (int argc, char *argv[]) /* We add 2 = 1(klog) + 1(inet), even if they may be not use. */ fdarray = (struct pollfd *) malloc ((nfunix + 2) * sizeof (*fdarray)); if (fdarray == NULL) - error (2, errno, "can't allocate fd table"); + error (EXIT_FAILURE, errno, "can't allocate fd table"); /* read configuration file */ init (0); @@ -747,7 +747,7 @@ add_funix (const char *name) { funix = realloc (funix, (nfunix + 1) * sizeof (*funix)); if (funix == NULL) - error (1, errno, "cannot allocate space for unix sockets"); + error (EXIT_FAILURE, errno, "cannot allocate space for unix sockets"); funix[nfunix].name = name; funix[nfunix].fd = -1; @@ -841,7 +841,7 @@ crunch_list (char **oldlist, char *list) /* allocate enough space */ oldlist = (char **) realloc (oldlist, (i + count + 1) * sizeof (*oldlist)); if (oldlist == NULL) - error (1, errno, "can't allocate memory"); + error (EXIT_FAILURE, errno, "can't allocate memory"); /* We now can assume that the first and last @@ -854,7 +854,7 @@ crunch_list (char **oldlist, char *list) { oldlist[count] = (char *) malloc ((q - p + 1) * sizeof (char)); if (oldlist[count] == NULL) - error (1, errno, "can't allocate memory"); + error (EXIT_FAILURE, errno, "can't allocate memory"); strncpy (oldlist[count], p, q - p); oldlist[count][q - p] = '\0'; @@ -863,7 +863,7 @@ crunch_list (char **oldlist, char *list) /* take the last one */ oldlist[count] = (char *) malloc ((strlen (p) + 1) * sizeof (char)); if (oldlist[count] == NULL) - error (1, errno, "can't allocate memory"); + error (EXIT_FAILURE, errno, "can't allocate memory"); strcpy (oldlist[count], p); @@ -1536,7 +1536,7 @@ die (int signo) if (finet >= 0) close (finet); - exit (0); + exit (EXIT_SUCCESS); } /* INIT -- Initialize syslogd from configuration table. */ diff --git a/src/tftp.c b/src/tftp.c index 17026048..26fef102 100644 --- a/src/tftp.c +++ b/src/tftp.c @@ -233,27 +233,27 @@ main (int argc, char *argv[]) if (sp == 0) { fprintf (stderr, "tftp: udp/tftp: unknown service\n"); - exit (1); + exit (EXIT_FAILURE); } f = socket (AF_INET, SOCK_DGRAM, 0); if (f < 0) { perror ("tftp: socket"); - exit (3); + exit (EXIT_FAILURE); } memset (&sin, 0, sizeof (sin)); sin.sin_family = AF_INET; if (bind (f, (struct sockaddr *) &sin, sizeof (sin)) < 0) { perror ("tftp: bind"); - exit (1); + exit (EXIT_FAILURE); } strcpy (mode, "netascii"); signal (SIGINT, intr); if (hostport_argc > 1) { if (setjmp (toplevel) != 0) - exit (0); + exit (EXIT_SUCCESS); setpeer (hostport_argc, hostport_argv); } if (setjmp (toplevel) != 0) @@ -693,7 +693,7 @@ command () if (fgets (line, sizeof line, stdin) == 0) { if (feof (stdin)) - exit (0); + exit (EXIT_SUCCESS); else continue; } @@ -780,7 +780,7 @@ makeargv () void quit (int argc, char *argv[]) { - exit (0); + exit (EXIT_SUCCESS); } /* diff --git a/src/tftpd.c b/src/tftpd.c index 3f6539cf..e5c6548d 100644 --- a/src/tftpd.c +++ b/src/tftpd.c @@ -200,14 +200,14 @@ main (int argc, char *argv[]) if (ioctl (0, FIONBIO, &on) < 0) { syslog (LOG_ERR, "ioctl(FIONBIO): %m\n"); - exit (1); + exit (EXIT_FAILURE); } fromlen = sizeof (from); n = recvfrom (0, buf, sizeof (buf), 0, (struct sockaddr *) &from, &fromlen); if (n < 0) { syslog (LOG_ERR, "recvfrom: %m\n"); - exit (1); + exit (EXIT_FAILURE); } /* * Now that we have read the message out of the UDP @@ -261,11 +261,11 @@ main (int argc, char *argv[]) if (pid < 0) { syslog (LOG_ERR, "fork: %m\n"); - exit (1); + exit (EXIT_FAILURE); } else if (pid != 0) { - exit (0); + exit (EXIT_SUCCESS); } } from.sin_family = AF_INET; @@ -276,25 +276,25 @@ main (int argc, char *argv[]) if (peer < 0) { syslog (LOG_ERR, "socket: %m\n"); - exit (1); + exit (EXIT_FAILURE); } memset (&sin, 0, sizeof (sin)); sin.sin_family = AF_INET; if (bind (peer, (struct sockaddr *) &sin, sizeof (sin)) < 0) { syslog (LOG_ERR, "bind: %m\n"); - exit (1); + exit (EXIT_FAILURE); } if (connect (peer, (struct sockaddr *) &from, sizeof (from)) < 0) { syslog (LOG_ERR, "connect: %m\n"); - exit (1); + exit (EXIT_FAILURE); } tp = (struct tftphdr *) buf; tp->th_opcode = ntohs (tp->th_opcode); if (tp->th_opcode == RRQ || tp->th_opcode == WRQ) tftp (tp, n); - exit (1); + exit (EXIT_FAILURE); } struct formats; @@ -338,7 +338,7 @@ again: if (*cp != '\0') { nak (EBADOP); - exit (1); + exit (EXIT_FAILURE); } if (first) { @@ -355,7 +355,7 @@ again: if (pf->f_mode == 0) { nak (EBADOP); - exit (1); + exit (EXIT_FAILURE); } ecode = (*pf->f_validate) (&filename, tp->th_opcode); if (logging) @@ -372,15 +372,15 @@ again: * bootfile pathname from a diskless Sun. */ if (suppress_naks && *filename != '/' && ecode == ENOTFOUND) - exit (0); + exit (EXIT_SUCCESS); nak (ecode); - exit (1); + exit (EXIT_FAILURE); } if (tp->th_opcode == WRQ) (*pf->f_recv) (pf); else (*pf->f_send) (pf); - exit (0); + exit (EXIT_SUCCESS); } @@ -505,7 +505,7 @@ timer (int sig) timeout += rexmtval; if (timeout >= maxtimeout) - exit (1); + exit (EXIT_FAILURE); siglongjmp (timeoutbuf, 1); } @@ -581,7 +581,7 @@ abort: void justquit (int sig) { - exit (0); + exit (EXIT_SUCCESS); } diff --git a/src/traceroute.c b/src/traceroute.c index e3189d5b..0b02fa3c 100644 --- a/src/traceroute.c +++ b/src/traceroute.c @@ -204,14 +204,14 @@ main (int argc, char **argv) while (!stop) { if (hop > opt_max_hops) - exit (0); + exit (EXIT_SUCCESS); do_try (&trace, hop, opt_max_hops, opt_max_tries); trace_inc_ttl (&trace); trace_inc_port (&trace); hop++; } - exit (0); + exit (EXIT_SUCCESS); } void diff --git a/src/uucpd.c b/src/uucpd.c index 5bd7979c..0c6bb2a3 100644 --- a/src/uucpd.c +++ b/src/uucpd.c @@ -125,10 +125,10 @@ main (int argc, char **argv) if (sp == NULL) { perror ("uucpd: getservbyname"); - exit (1); + exit (EXIT_FAILURE); } if (fork ()) - exit (0); + exit (EXIT_SUCCESS); if ((s = open (PATH_TTY, O_RDWR)) >= 0) { ioctl (s, TIOCNOTTY, (char *) 0); diff --git a/talk/init_disp.c b/talk/init_disp.c index 29790c7e..90d4b064 100644 --- a/talk/init_disp.c +++ b/talk/init_disp.c @@ -94,7 +94,7 @@ init_display () #endif if (initscr () == NULL) - error (1, 0, "Terminal type unset or lacking necessary features."); + error (EXIT_FAILURE, 0, "Terminal type unset or lacking necessary features."); #ifdef HAVE_SIGACTION sigaction (SIGTSTP, (struct sigaction *) 0, &siga); @@ -226,5 +226,5 @@ quit () } if (invitation_waiting) send_delete (); - exit (0); + exit (EXIT_SUCCESS); } diff --git a/talkd/acl.c b/talkd/acl.c index 98137417..d88bfab0 100644 --- a/talkd/acl.c +++ b/talkd/acl.c @@ -120,7 +120,7 @@ netdef_parse (char *str) if (!netdef) { syslog (LOG_ERR, "out of memory"); - exit (1); + exit (EXIT_FAILURE); } netdef->next = NULL; @@ -218,7 +218,7 @@ read_acl (char *config_file) if (!acl) { syslog (LOG_CRIT, "out of memory"); - exit (1); + exit (EXIT_FAILURE); } acl->next = NULL; acl->action = action; diff --git a/talkd/announce.c b/talkd/announce.c index 8b3e98f4..f05f0a8e 100644 --- a/talkd/announce.c +++ b/talkd/announce.c @@ -137,7 +137,7 @@ announce (CTL_MSG * request, char *remote_machine) if (!ttypath) { syslog (LOG_CRIT, "out of memory"); - exit (1); + exit (EXIT_FAILURE); } sprintf (ttypath, "%s/%s", PATH_DEV, request->r_tty); rc = stat (ttypath, &st); diff --git a/talkd/table.c b/talkd/table.c index 13419b5f..28171802 100644 --- a/talkd/table.c +++ b/talkd/table.c @@ -154,7 +154,7 @@ insert_table (CTL_MSG * request, CTL_RESPONSE * response) if (!ptr) { syslog (LOG_CRIT, "out of memory"); - exit (1); + exit (EXIT_FAILURE); } request->id_num = new_id (); diff --git a/talkd/talkd.c b/talkd/talkd.c index 6e604243..90ef3cfb 100644 --- a/talkd/talkd.c +++ b/talkd/talkd.c @@ -113,7 +113,7 @@ talkd_init () if (!hostname) { syslog (LOG_ERR, "can't determine my hostname: %m"); - exit (1); + exit (EXIT_FAILURE); } } @@ -123,7 +123,7 @@ static void alarm_handler (int err ARG_UNUSED) { if ((time (NULL) - last_msg_time) >= max_idle_time) - exit (0); + exit (EXIT_SUCCESS); alarm (timeout); } diff --git a/telnet/main.c b/telnet/main.c index d731cbb8..1181cf30 100644 --- a/telnet/main.c +++ b/telnet/main.c @@ -351,7 +351,7 @@ main (int argc, char *argv[]) char *args[8], **argp = args; if (argc > 2) - error (1, 0, "too many arguments"); + error (EXIT_FAILURE, 0, "too many arguments"); *argp++ = prompt; if (user) { diff --git a/telnet/network.c b/telnet/network.c index 63994fe1..22799001 100644 --- a/telnet/network.c +++ b/telnet/network.c @@ -77,11 +77,11 @@ init_network () { if (ring_init (&netoring, netobuf, sizeof netobuf) != 1) { - exit (1); + exit (EXIT_FAILURE); } if (ring_init (&netiring, netibuf, sizeof netibuf) != 1) { - exit (1); + exit (EXIT_FAILURE); } NetTrace = stdout; } diff --git a/telnet/terminal.c b/telnet/terminal.c index a7d21687..24c80d13 100644 --- a/telnet/terminal.c +++ b/telnet/terminal.c @@ -109,11 +109,11 @@ init_terminal () { if (ring_init (&ttyoring, ttyobuf, sizeof ttyobuf) != 1) { - exit (1); + exit (EXIT_FAILURE); } if (ring_init (&ttyiring, ttyibuf, sizeof ttyibuf) != 1) { - exit (1); + exit (EXIT_FAILURE); } autoflush = TerminalAutoFlush (); } diff --git a/telnetd/pty.c b/telnetd/pty.c index a5db6a3c..321f25c8 100644 --- a/telnetd/pty.c +++ b/telnetd/pty.c @@ -49,7 +49,7 @@ startslave (char *host, int autologin, char *autoname) if (autologin < auth_level) { fatal (net, "Authorization failed"); - exit (1); + exit (EXIT_FAILURE); } #endif pid = forkpty (&master, line, NULL, NULL); @@ -149,5 +149,5 @@ cleanup (int sig) chmod (line, 0644); chown (line, 0, 0); shutdown (net, 2); - exit (1); + exit (EXIT_FAILURE); } diff --git a/telnetd/state.c b/telnetd/state.c index 158e6bb4..1ff43f37 100644 --- a/telnetd/state.c +++ b/telnetd/state.c @@ -449,7 +449,7 @@ telrcv () default: syslog (LOG_ERR, "telnetd: panic state=%d\n", state); printf ("telnetd: panic state=%d\n", state); - exit (1); + exit (EXIT_FAILURE); } } } /* end of telrcv */ diff --git a/telnetd/telnetd.c b/telnetd/telnetd.c index cdeaedb0..e086c28b 100644 --- a/telnetd/telnetd.c +++ b/telnetd/telnetd.c @@ -179,7 +179,7 @@ main (int argc, char **argv) argp_parse (&argp, argc, argv, 0, &index, NULL); if (argc != index) - error (1, 0, "junk arguments in the command line"); + error (EXIT_FAILURE, 0, "junk arguments in the command line"); openlog ("telnetd", LOG_PID | LOG_ODELAY, LOG_DAEMON); telnetd_setup (0); @@ -296,7 +296,7 @@ telnetd_setup (int fd) if (getpeername (fd, (struct sockaddr *) &saddr, &len) < 0) { syslog (LOG_ERR, "getpeername: %m"); - exit (1); + exit (EXIT_FAILURE); } #ifdef IPV6 @@ -362,7 +362,7 @@ telnetd_setup (int fd) { syslog (LOG_AUTH | LOG_NOTICE, "None of addresses of %s matched %s", remote_hostname, buf); - exit (0); + exit (EXIT_SUCCESS); } freeaddrinfo (result); @@ -409,7 +409,7 @@ telnetd_setup (int fd) syslog (LOG_AUTH | LOG_NOTICE, "None of addresses of %s matched %s", remote_hostname, inet_ntoa (saddr.sin_addr)); - exit (0); + exit (EXIT_SUCCESS); } } else diff --git a/telnetd/utility.c b/telnetd/utility.c index 81e36105..d31598b8 100644 --- a/telnetd/utility.c +++ b/telnetd/utility.c @@ -405,12 +405,12 @@ again: goto again; } syslog (LOG_INFO, "ttloop: read: %m\n"); - exit (1); + exit (EXIT_FAILURE); } else if (ncc == 0) { syslog (LOG_INFO, "ttloop: peer died: %m\n"); - exit (1); + exit (EXIT_FAILURE); } DEBUG (debug_report, 1, debug_output_data ("td: ttloop read %d chars\r\n", ncc)); @@ -644,7 +644,7 @@ fatal (int f, char *msg) #endif /* ENCRYPTION */ write (f, buf, (int) strlen (buf)); sleep (1); - /*FIXME*/ exit (1); + /*FIXME*/ exit (EXIT_FAILURE); } void diff --git a/whois/whois.c b/whois/whois.c index aafce61b..7b41b692 100644 --- a/whois/whois.c +++ b/whois/whois.c @@ -211,7 +211,7 @@ main (int argc, char *argv[]) argv += index; if (argc == 0 && !nopar) /* there is no parameter */ - error (1, 0, "not enough arguments"); + error (EXIT_FAILURE, 0, "not enough arguments"); /* parse other parameters, if any */ if (!nopar) @@ -235,7 +235,7 @@ main (int argc, char *argv[]) server = query_crsnic (sockfd, qstring); closeconn (sockfd); if (!server) - exit (0); + exit (EXIT_SUCCESS); printf (_("\nFound InterNIC referral to %s.\n\n"), server); } @@ -255,10 +255,10 @@ main (int argc, char *argv[]) "whois database at")); case 2: puts (server + 1); - exit (0); + exit (EXIT_SUCCESS); case 3: puts (_("This TLD has no whois server.")); - exit (0); + exit (EXIT_SUCCESS); default: if (verb) printf (_("Using server %s.\n"), server); @@ -280,7 +280,7 @@ main (int argc, char *argv[]) do_query (sockfd, p); closeconn (sockfd); - exit (0); + exit (EXIT_SUCCESS); } const char * @@ -650,7 +650,7 @@ err_sys (const char *fmt, ...) vfprintf (stderr, fmt, ap); fprintf (stderr, ": %s\n", strerror (errno)); va_end (ap); - exit (2); + exit (EXIT_FAILURE); } void @@ -662,5 +662,5 @@ err_quit (const char *fmt, ...) vfprintf (stderr, fmt, ap); fputs ("\n", stderr); va_end (ap); - exit (2); + exit (EXIT_FAILURE); }