masqmail

changeset 407:164468dd0953

Minor refactoring.
author markus schnalke <meillo@marmaro.de>
date Wed, 29 Feb 2012 10:37:21 +0100
parents 8518fe2b0f36
children f609a05ddff8
files src/interface.c
diffstat 1 files changed, 13 insertions(+), 7 deletions(-) [+]
line diff
     1.1 --- a/src/interface.c	Wed Feb 29 10:34:27 2012 +0100
     1.2 +++ b/src/interface.c	Wed Feb 29 10:37:21 2012 +0100
     1.3 @@ -30,21 +30,25 @@
     1.4  
     1.5  #ifdef SOCKADDR_OLD
     1.6  	/* here I tried to be intelligent and failed. */
     1.7 -	if (isalpha(iface->address[0])) {
     1.8 +	if (isalpha(*iface->address)) {
     1.9  		if ((he = gethostbyname(iface->address)) == NULL) {
    1.10 -			logwrite(LOG_ALERT, "local address '%s' unknown. (deleting)\n", iface->address);
    1.11 +			logwrite(LOG_ALERT, "local address '%s' unknown. "
    1.12 +					"(deleting)\n", iface->address);
    1.13  			return FALSE;
    1.14  		}
    1.15  		memcpy(&(name->sin_addr), he->h_addr, sizeof(name->sin_addr));
    1.16 -	} else if (isdigit(iface->address[0])) {
    1.17 +	} else if (isdigit(*iface->address)) {
    1.18  		if (inet_aton(iface->address, &ia)) {
    1.19  			memcpy(&(name->sin_addr), &ia, sizeof(name->sin_addr));
    1.20  		} else {
    1.21 -			logwrite(LOG_ALERT, "invalid address '%s': inet_aton() failed (deleting)\n", iface->address);
    1.22 +			logwrite(LOG_ALERT, "invalid address '%s': "
    1.23 +					"inet_aton() failed (deleting)\n",
    1.24 +					iface->address);
    1.25  			return FALSE;
    1.26  		}
    1.27  	} else {
    1.28 -		logwrite(LOG_ALERT, "invalid address '%s', should begin with a aphanumeric (deleting)\n", iface->address);
    1.29 +		logwrite(LOG_ALERT, "invalid address '%s', should begin with "
    1.30 +				"a aphanumeric (deleting)\n", iface->address);
    1.31  		return FALSE;
    1.32  	}
    1.33  #else
    1.34 @@ -54,7 +58,8 @@
    1.35  		memcpy(&(name->sin_addr), &ia, sizeof(name->sin_addr));
    1.36  	} else {
    1.37  		if ((he = gethostbyname(iface->address)) == NULL) {
    1.38 -			logwrite(LOG_ALERT, "local address '%s' unknown. (deleting)\n", iface->address);
    1.39 +			logwrite(LOG_ALERT, "local address '%s' unknown. "
    1.40 +					"(deleting)\n", iface->address);
    1.41  			return FALSE;
    1.42  		}
    1.43  		memcpy(&(name->sin_addr), he->h_addr, sizeof(name->sin_addr));
    1.44 @@ -83,7 +88,8 @@
    1.45  
    1.46  	if (init_sockaddr(&server, iface)) {
    1.47  		/* bind the socket */
    1.48 -		if (bind(sock, (struct sockaddr *) &server, sizeof(server)) < 0) {
    1.49 +		if (bind(sock, (struct sockaddr *) &server,
    1.50 +				sizeof(server)) < 0) {
    1.51  			logwrite(LOG_ALERT, "bind: %s\n", strerror(errno));
    1.52  			return -1;
    1.53  		}