git-svn: trunk@2273
Tomasz Kojm authored on 2006/09/15 07:56:00... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Fri Sep 15 00:52:48 CEST 2006 (tk) |
|
2 |
+---------------------------------- |
|
3 |
+ * freshclam: fix compilation error on systems without SO_ERROR defined, |
|
4 |
+ patch from Everton Marques <everton.marques*gmail.com> |
|
5 |
+ |
|
1 | 6 |
Fri Sep 15 00:42:27 CEST 2006 (tk) |
2 | 7 |
---------------------------------- |
3 | 8 |
* clamd/server-th.c: minor cleanup |
... | ... |
@@ -196,7 +196,11 @@ static int wwwconnect(const char *server, const char *proxy, int pport, char *ip |
196 | 196 |
name.sin_addr = *((struct in_addr *) host->h_addr_list[i]); |
197 | 197 |
name.sin_port = htons(port); |
198 | 198 |
|
199 |
+#ifdef SO_ERROR |
|
199 | 200 |
if(wait_connect(socketfd, (struct sockaddr *) &name, sizeof(struct sockaddr_in), ctimeout) == -1) { |
201 |
+#else |
|
202 |
+ if(connect(socketfd, (struct sockaddr *) &name, sizeof(struct sockaddr_in)) == -1) { |
|
203 |
+#endif |
|
200 | 204 |
logg("Can't connect to port %d of host %s (IP: %s)\n", port, hostpt, ipaddr); |
201 | 205 |
continue; |
202 | 206 |
} else { |
... | ... |
@@ -366,7 +370,11 @@ static struct cl_cvd *remote_cvdhead(const char *file, const char *hostname, cha |
366 | 366 |
|
367 | 367 |
tmp = buffer; |
368 | 368 |
cnt = FILEBUFF; |
369 |
+#ifdef SO_ERROR |
|
369 | 370 |
while((bread = wait_recv(sd, tmp, cnt, 0, rtimeout)) > 0) { |
371 |
+#else |
|
372 |
+ while((bread = recv(sd, tmp, cnt, 0)) > 0) { |
|
373 |
+#endif |
|
370 | 374 |
tmp += bread; |
371 | 375 |
cnt -= bread; |
372 | 376 |
if(cnt <= 0) |
... | ... |
@@ -506,7 +514,11 @@ static int getfile(const char *srcfile, const char *destfile, const char *hostna |
506 | 506 |
i = 0; |
507 | 507 |
while(1) { |
508 | 508 |
/* recv one byte at a time, until we reach \r\n\r\n */ |
509 |
+#ifdef SO_ERROR |
|
509 | 510 |
if((i >= sizeof(buffer) - 1) || wait_recv(sd, buffer + i, 1, 0, rtimeout) == -1) { |
511 |
+#else |
|
512 |
+ if((i >= sizeof(buffer) - 1) || recv(sd, buffer + i, 1, 0) == -1) { |
|
513 |
+#endif |
|
510 | 514 |
logg("!getfile: Error while reading database from %s\n", hostname); |
511 | 515 |
return 52; |
512 | 516 |
} |
... | ... |
@@ -557,7 +569,11 @@ static int getfile(const char *srcfile, const char *destfile, const char *hostna |
557 | 557 |
return 57; |
558 | 558 |
} |
559 | 559 |
|
560 |
+#ifdef SO_ERROR |
|
560 | 561 |
while((bread = wait_recv(sd, buffer, FILEBUFF, 0, rtimeout)) > 0) { |
562 |
+#else |
|
563 |
+ while((bread = recv(sd, buffer, FILEBUFF, 0)) > 0) { |
|
564 |
+#endif |
|
561 | 565 |
if(write(fd, buffer, bread) != bread) { |
562 | 566 |
logg("getfile: Can't write %d bytes to %s\n", bread, destfile); |
563 | 567 |
unlink(destfile); |
... | ... |
@@ -40,6 +40,8 @@ |
40 | 40 |
|
41 | 41 |
#include "shared/output.h" |
42 | 42 |
|
43 |
+#ifdef SO_ERROR |
|
44 |
+ |
|
43 | 45 |
#ifndef timercmp |
44 | 46 |
# define timercmp(a, b, cmp) \ |
45 | 47 |
(((a)->tv_sec == (b)->tv_sec) ? \ |
... | ... |
@@ -290,3 +292,4 @@ ssize_t wait_recv(int sock, void *buf, size_t len, int flags, int secs) |
290 | 290 |
return ret; |
291 | 291 |
} |
292 | 292 |
|
293 |
+#endif /* SO_ERROR */ |