Module: ngircd.git Branch: master Commit: 3a3b3225d42ede7a062fa5e4403a7f445baf518b URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=3a3b3...
Author: Alexander Barton alex@barton.de Date: Sun Jan 27 20:57:25 2013 +0100
NewListener(): Code cleanup
---
src/ngircd/conn.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index 142cf23..07f26f3 100644 --- a/src/ngircd/conn.c +++ b/src/ngircd/conn.c @@ -620,8 +620,9 @@ NewListener(const char *listen_addr, UINT16 Port)
af = ng_ipaddr_af(&addr); sock = socket(af, SOCK_STREAM, 0); - if( sock < 0 ) { - Log(LOG_CRIT, "Can't create socket (af %d) : %s!", af, strerror(errno)); + if (sock < 0) { + Log(LOG_CRIT, "Can't create socket (af %d) : %s!", af, + strerror(errno)); return -1; }
@@ -632,21 +633,22 @@ NewListener(const char *listen_addr, UINT16 Port)
if (bind(sock, (struct sockaddr *)&addr, ng_ipaddr_salen(&addr)) != 0) { Log(LOG_CRIT, "Can't bind socket to address %s:%d - %s!", - ng_ipaddr_tostr(&addr), Port, strerror(errno)); + ng_ipaddr_tostr(&addr), Port, strerror(errno)); close(sock); return -1; }
- if( listen( sock, 10 ) != 0 ) { - Log( LOG_CRIT, "Can't listen on socket: %s!", strerror( errno )); - close( sock ); + if (listen(sock, 10) != 0) { + Log(LOG_CRIT, "Can't listen on socket: %s!", strerror(errno)); + close(sock); return -1; }
/* keep fd in list so we can close it when ngircd restarts/shuts down */ - if (!array_catb( &My_Listeners,(char*) &sock, sizeof(int) )) { - Log( LOG_CRIT, "Can't add socket to My_Listeners array: %s!", strerror( errno )); - close( sock ); + if (!array_catb(&My_Listeners, (char *)&sock, sizeof(int))) { + Log(LOG_CRIT, "Can't add socket to My_Listeners array: %s!", + strerror(errno)); + close(sock); return -1; }
ngircd-commits@lists.barton.de