git-svn: trunk@1695
Nigel Horne authored on 2005/08/16 06:14:01... | ... |
@@ -22,9 +22,9 @@ |
22 | 22 |
* |
23 | 23 |
* For installation instructions see the file INSTALL that came with this file |
24 | 24 |
*/ |
25 |
-static char const rcsid[] = "$Id: clamav-milter.c,v 1.217 2005/08/11 20:13:38 nigelhorne Exp $"; |
|
25 |
+static char const rcsid[] = "$Id: clamav-milter.c,v 1.218 2005/08/15 21:12:21 nigelhorne Exp $"; |
|
26 | 26 |
|
27 |
-#define CM_VERSION "devel-110805" |
|
27 |
+#define CM_VERSION "devel-150805" |
|
28 | 28 |
|
29 | 29 |
#if HAVE_CONFIG_H |
30 | 30 |
#include "clamav-config.h" |
... | ... |
@@ -3442,11 +3442,17 @@ clamd_recv(int sock, char *buf, size_t len) |
3442 | 3442 |
{ |
3443 | 3443 |
fd_set rfds; |
3444 | 3444 |
struct timeval tv; |
3445 |
+ int ret; |
|
3445 | 3446 |
|
3446 | 3447 |
assert(sock >= 0); |
3447 | 3448 |
|
3448 |
- if(readTimeout == 0) |
|
3449 |
- return recv(sock, buf, len, 0); |
|
3449 |
+ if(readTimeout == 0) { |
|
3450 |
+ do |
|
3451 |
+ ret = recv(sock, buf, len, 0); |
|
3452 |
+ while((ret < 0) && (errno == EINTR)); |
|
3453 |
+ |
|
3454 |
+ return ret; |
|
3455 |
+ } |
|
3450 | 3456 |
|
3451 | 3457 |
FD_ZERO(&rfds); |
3452 | 3458 |
FD_SET(sock, &rfds); |
... | ... |
@@ -3454,16 +3460,27 @@ clamd_recv(int sock, char *buf, size_t len) |
3454 | 3454 |
tv.tv_sec = readTimeout; |
3455 | 3455 |
tv.tv_usec = 0; |
3456 | 3456 |
|
3457 |
- switch(select(sock + 1, &rfds, NULL, NULL, &tv)) { |
|
3458 |
- case -1: |
|
3459 |
- perror("select"); |
|
3460 |
- return -1; |
|
3461 |
- case 0: |
|
3462 |
- if(use_syslog) |
|
3463 |
- syslog(LOG_ERR, _("No data received from clamd in %d seconds\n"), readTimeout); |
|
3464 |
- return 0; |
|
3457 |
+ for(;;) { |
|
3458 |
+ switch(select(sock + 1, &rfds, NULL, NULL, &tv)) { |
|
3459 |
+ case -1: |
|
3460 |
+ if(errno == EINTR) |
|
3461 |
+ /* FIXME: work out time left */ |
|
3462 |
+ continue; |
|
3463 |
+ perror("select"); |
|
3464 |
+ return -1; |
|
3465 |
+ case 0: |
|
3466 |
+ if(use_syslog) |
|
3467 |
+ syslog(LOG_ERR, _("No data received from clamd in %d seconds\n"), readTimeout); |
|
3468 |
+ return 0; |
|
3469 |
+ } |
|
3470 |
+ break; |
|
3465 | 3471 |
} |
3466 |
- return recv(sock, buf, len, 0); |
|
3472 |
+ |
|
3473 |
+ do |
|
3474 |
+ ret = recv(sock, buf, len, 0); |
|
3475 |
+ while((ret < 0) && (errno == EINTR)); |
|
3476 |
+ |
|
3477 |
+ return ret; |
|
3467 | 3478 |
} |
3468 | 3479 |
|
3469 | 3480 |
/* |