Browse code

Fallback to CURLOPT_FILE if CURLOPT_WRITEDATA isn't defined

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@915 77e5149b-7576-45b1-b177-96237e5ba77b

Nigel Horne authored on 2004/09/21 21:22:07
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Tue Sep 21 13:20:31 BST 2004 (njh)
2
+----------------------------------
3
+  * libclamav/mbox.c:	Fallback to CURLOPT_FILE if CURLOPT_WRITEDATA isn't
4
+				defined
5
+
1 6
 Tue Sep 21 10:27:29 BST 2004 (njh)
2 7
 ----------------------------------
3 8
   * libclamav/blob.c:	When built with "--enable-debug", closing a closed blob
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: mbox.c,v $
20
+ * Revision 1.136  2004/09/21 12:18:52  nigelhorne
21
+ * Fallback to CURLOPT_FILE if CURLOPT_WRITEDATA isn't defined
22
+ *
20 23
  * Revision 1.135  2004/09/21 08:14:00  nigelhorne
21 24
  * Now compiles in machines with libcurl but without threads
22 25
  *
... ...
@@ -393,7 +396,7 @@
393 393
  * Compilable under SCO; removed duplicate code with message.c
394 394
  *
395 395
  */
396
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.135 2004/09/21 08:14:00 nigelhorne Exp $";
396
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.136 2004/09/21 12:18:52 nigelhorne Exp $";
397 397
 
398 398
 #if HAVE_CONFIG_H
399 399
 #include "clamav-config.h"
... ...
@@ -2698,12 +2701,21 @@ getURL(struct arg *arg)
2698 2698
 		curl_easy_cleanup(curl);
2699 2699
 		return NULL;
2700 2700
 	}
2701
+#ifdef	CURLOPT_WRITEDATA
2701 2702
 	if(curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp) != 0) {
2702 2703
 		fclose(fp);
2703 2704
 		free(fout);
2704 2705
 		curl_easy_cleanup(curl);
2705 2706
 		return NULL;
2706 2707
 	}
2708
+#else
2709
+	if(curl_easy_setopt(curl, CURLOPT_FILE, fp) != 0) {
2710
+		fclose(fp);
2711
+		free(fout);
2712
+		curl_easy_cleanup(curl);
2713
+		return NULL;
2714
+	}
2715
+#endif
2707 2716
 
2708 2717
 	/*
2709 2718
 	 * If an item is in squid's cache get it from there (TCP_HIT/200)