masqmail

diff src/listen.c @ 262:fc1c6425c024

s/EXIT_SUCCESS/0/ && s/EXIT_FAILURE/1/ The constants are all to bulky. We should have different, meaningful exit codes anyway.
author markus schnalke <meillo@marmaro.de>
date Thu, 02 Dec 2010 17:11:25 -0300
parents dcb315792513
children 63efd381e27b
line diff
     1.1 --- a/src/listen.c	Thu Dec 02 16:52:39 2010 -0300
     1.2 +++ b/src/listen.c	Thu Dec 02 17:11:25 2010 -0300
     1.3 @@ -38,7 +38,7 @@
     1.4  
     1.5  	pid = waitpid(0, &status, 0);
     1.6  	if (pid > 0) {
     1.7 -		if (WEXITSTATUS(status) != EXIT_SUCCESS)
     1.8 +		if (WEXITSTATUS(status) != 0)
     1.9  			logwrite(LOG_WARNING, "process %d exited with %d\n", pid, WEXITSTATUS(status));
    1.10  		if (WIFSIGNALED(status))
    1.11  			logwrite(LOG_WARNING, "process with pid %d got signal: %d\n", pid, WTERMSIG(status));
    1.12 @@ -79,7 +79,7 @@
    1.13  
    1.14  		smtp_in(in, out, rem_host, ident);
    1.15  
    1.16 -		_exit(EXIT_SUCCESS);
    1.17 +		_exit(0);
    1.18  	} else if (pid < 0) {
    1.19  		logwrite(LOG_WARNING, "could not fork for incoming smtp connection: %s\n", strerror(errno));
    1.20  	}
    1.21 @@ -118,7 +118,7 @@
    1.22  		}
    1.23  		if (listen(sock, 1) < 0) {
    1.24  			logwrite(LOG_ALERT, "listen: (terminating): %s\n", strerror(errno));
    1.25 -			exit(EXIT_FAILURE);
    1.26 +			exit(1);
    1.27  		}
    1.28  		logwrite(LOG_NOTICE, "listening on interface %s:%d\n", iface->address, iface->port);
    1.29  		DEBUG(5) debugf("sock = %d\n", sock);
    1.30 @@ -133,11 +133,11 @@
    1.31  	if (!conf.run_as_user) {
    1.32  		if (setegid(conf.mail_gid) != 0) {
    1.33  			logwrite(LOG_ALERT, "could not change gid to %d: %s\n", conf.mail_gid, strerror(errno));
    1.34 -			exit(EXIT_FAILURE);
    1.35 +			exit(1);
    1.36  		}
    1.37  		if (seteuid(conf.mail_uid) != 0) {
    1.38  			logwrite(LOG_ALERT, "could not change uid to %d: %s\n", conf.mail_uid, strerror(errno));
    1.39 -			exit(EXIT_FAILURE);
    1.40 +			exit(1);
    1.41  		}
    1.42  	}
    1.43  
    1.44 @@ -173,7 +173,7 @@
    1.45  		if ((sel_ret = select(FD_SETSIZE, &read_fd_set, NULL, NULL, qival > 0 ? &tm : NULL)) < 0) {
    1.46  			if (errno != EINTR) {
    1.47  				logwrite(LOG_ALERT, "select: (terminating): %s\n", strerror(errno));
    1.48 -				exit(EXIT_FAILURE);
    1.49 +				exit(1);
    1.50  			} else {
    1.51  				if (sighup_seen) {
    1.52  					logwrite(LOG_NOTICE, "HUP signal received. Restarting daemon\n");
    1.53 @@ -184,7 +184,7 @@
    1.54  
    1.55  					execv(argv[0], &(argv[0]));
    1.56  					logwrite(LOG_ALERT, "restarting failed: %s\n", strerror(errno));
    1.57 -					exit(EXIT_FAILURE);
    1.58 +					exit(1);
    1.59  				}
    1.60  			}
    1.61  		} else if (sel_ret > 0) {
    1.62 @@ -208,7 +208,7 @@
    1.63  			if ((pid = fork()) == 0) {
    1.64  				queue_run();
    1.65  
    1.66 -				_exit(EXIT_SUCCESS);
    1.67 +				_exit(0);
    1.68  			} else if (pid < 0) {
    1.69  				logwrite(LOG_ALERT, "could not fork for queue run");
    1.70  			}