Small bugfixes for http-push.c
This patch fixes three things: - older libexpat does not know about enum XML_Status - as in my patch for http-fetch, do not rely on a curl result in free()d data - calloc the new_lock structure Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Johannes Schindelin committed
Nov 7, 2005 at 19:23 UTC
92e2eb9c0a868348dd2caf2b923fd6542ca7ceb7
1 file changed
+12
-2
http-push.c
+12
-2
@@ -28,6 +28,15 @@ static const char http_push_usage[] =
28
#define NO_CURL_EASY_DUPHANDLE
29
#endif
30
31
+#ifndef XML_STATUS_OK
32
+enum XML_Status {
33
+ XML_STATUS_OK = 1,
34
+ XML_STATUS_ERROR = 0
35
+};
36
+#define XML_STATUS_OK 1
37
+#define XML_STATUS_ERROR 0
38
+#endif
39
+
40
#define RANGE_HEADER_SIZE 30
41
42
/* DAV method names and request body templates */
@@ -731,11 +740,12 @@ void process_curl_messages(void)
740
slot->curl != curl_message->easy_handle)
741
slot = slot->next;
742
if (slot != NULL) {
743
+ int curl_result = curl_message->data.result;
744
curl_multi_remove_handle(curlm, slot->curl);
745
active_requests--;
746
slot->done = 1;
747
slot->in_use = 0;
738
- slot->curl_result = curl_message->data.result;
748
+ slot->curl_result = curl_result;
749
curl_easy_getinfo(slot->curl,
750
CURLINFO_HTTP_CODE,
751
&slot->http_code);
@@ -1236,7 +1246,7 @@ struct active_lock *lock_remote(char *file, long timeout)
1246
in_buffer.posn = 0;
1247
in_buffer.buffer = in_data;
1248
1239
- new_lock = xmalloc(sizeof(*new_lock));
1249
+ new_lock = xcalloc(1, sizeof(*new_lock));
1250
new_lock->owner = NULL;
1251
new_lock->token = NULL;
1252
new_lock->timeout = -1;