# HG changeset patch # User Matti Hamalainen # Date 1226089064 -7200 # Node ID 7b98da167a0b0343b16060583481cf22ffadf056 # Parent 8d9c065241b715ab444f7bb3e1d24e3027fbbd33 Improved error handling. diff -r 8d9c065241b7 -r 7b98da167a0b nnchat.c --- a/nnchat.c Fri Nov 07 22:17:33 2008 +0200 +++ b/nnchat.c Fri Nov 07 22:17:44 2008 +0200 @@ -372,7 +372,7 @@ wrefresh(editWin); } -int openConnection(struct in_addr *addr, int port) +int openConnection(struct in_addr *addr, const int port) { struct sockaddr_in tmpAddr; int sock = -1; @@ -400,7 +400,7 @@ } -void closeConnection(int sock) +void closeConnection(const int sock) { if (sock >= 0) { close(sock); @@ -408,7 +408,7 @@ } -BOOL sendToSocket(int sock, char *buf, const size_t bufLen) +BOOL sendToSocket(const int sock, char *buf, const size_t bufLen) { size_t bufLeft = bufLen; char *bufPtr = buf; @@ -1305,9 +1305,10 @@ tv.tv_usec = SET_DELAY_USEC; tmpfds = sockfds; if ((result = select(tmpSocket+1, &tmpfds, NULL, NULL, &tv)) == -1) { - printMsg("Error occured in select(sockfds): %s\n", - strerror(errno)); - isError = TRUE; + if (errno != EINTR && errno != ERESTART) { + printMsg("Error occured in select(sockfds): %d, %s\n", errno, strerror(errno)); + isError = TRUE; + } } else if (FD_ISSET(tmpSocket, &tmpfds)) { ssize_t gotBuf; char tmpBuf[8192];