Commit 4bfd0689 authored by Matteo Quintiliani's avatar Matteo Quintiliani

Added reset of errno


git-svn-id: file:///home/quintiliani/svncopy/nmxptool/trunk@997 3cd66e75-5955-46cb-a940-c26e5fc5497d
parent 52f21dd8
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Istituto Nazionale di Geofisica e Vulcanologia - Italy * Istituto Nazionale di Geofisica e Vulcanologia - Italy
* quintiliani@ingv.it * quintiliani@ingv.it
* *
* $Id: nmxp_base.c,v 1.69 2008-03-31 05:09:33 mtheo Exp $ * $Id: nmxp_base.c,v 1.70 2008-03-31 07:44:39 mtheo Exp $
* *
*/ */
...@@ -161,6 +161,7 @@ int nmxp_recv_select_timeout(int s, char *buf, int len, int timeout) ...@@ -161,6 +161,7 @@ int nmxp_recv_select_timeout(int s, char *buf, int len, int timeout)
tv.tv_usec = 0; tv.tv_usec = 0;
/* wait until timeout or data received*/ /* wait until timeout or data received*/
errno = 0;
n = select(s+1, &fds, NULL, NULL, &tv); n = select(s+1, &fds, NULL, NULL, &tv);
if (n == 0) return -2; /* timeout!*/ if (n == 0) return -2; /* timeout!*/
if(errno == EINTR) return -2; /* timeout! "Interrupted system call" */ if(errno == EINTR) return -2; /* timeout! "Interrupted system call" */
...@@ -237,7 +238,7 @@ int nmxp_recv_ctrl(int isock, void *buffer, int length, int timeoutsec, int *rec ...@@ -237,7 +238,7 @@ int nmxp_recv_ctrl(int isock, void *buffer, int length, int timeoutsec, int *rec
while(cc > 0 && *recv_errno == 0 && recvCount < length) { while(cc > 0 && *recv_errno == 0 && recvCount < length) {
/* TODO some operating system could not reset errno */ /* TODO some operating system could not reset errno */
/* errno = 0 */ errno = 0;
#ifdef HAVE_BROKEN_SO_RCVTIMEO #ifdef HAVE_BROKEN_SO_RCVTIMEO
if(timeoutsec == 0) { if(timeoutsec == 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment