From: Tay Ray Chuan <rctay89@gmail•com>
To: Junio C Hamano <gitster@pobox•com>
Cc: Clemens Buchacher <drizzd@aon•at>,
git@vger•kernel.org,
Johannes Schindelin <Johannes.Schindelin@gmx•de>
Subject: [PATCH v2] http*: cleanup slot->local after fclose
Date: Sun, 31 May 2009 17:54:13 +0800 [thread overview]
Message-ID: <20090531175413.962a55c3.rctay89@gmail.com> (raw)
In-Reply-To: <7vy6sdssnk.fsf@alter.siamese.dyndns.org>
Set slot->local to NULL after doing a fclose on the FILE* pointer it
points to.
This fixes the issue raised by Clemens Buchacher on 30th May:
http://www.spinics.net/lists/git/msg104623.html
Signed-off-by: Tay Ray Chuan <rctay89@gmail•com>
---
On Sat, 30 May 2009 23:17:19 -0700
Junio C Hamano <gitster@pobox•com> wrote:
> Shouldn't a fix instead be queued for 'maint', without "refactoring"?
I tested this on top of the first 4 patches in 'rc/http-push' in 'pu',
applied on 'maint'. [1] I wonder if this should instead be queued for
'pu' [2], since the issue only occurs there, although, conceivably, it
*could* happen without those patches in 'pu'.
Footnotes:
[1] You can find this in the 'http-cleanup-slot-local_maint branch' at
git://github.com/rctay/git.git. It's quite a minimal testcase, if
you're looking for one.
[2] Found in 'http-cleanup-slot-local_pu'.
http-push.c | 6 ++++++
http-walker.c | 6 ++++++
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/http-push.c b/http-push.c
index e16a0ad..0b12ffe 100644
--- a/http-push.c
+++ b/http-push.c
@@ -724,9 +724,11 @@ static void finish_request(struct transfer_request *request)
struct stat st;
struct packed_git *target;
struct packed_git **lst;
+ struct active_request_slot *slot;
request->curl_result = request->slot->curl_result;
request->http_code = request->slot->http_code;
+ slot = request->slot;
request->slot = NULL;
/* Keep locks active */
@@ -823,6 +825,7 @@ static void finish_request(struct transfer_request *request)
fclose(request->local_stream);
request->local_stream = NULL;
+ slot->local = NULL;
if (!move_temp_to_file(request->tmpfile,
request->filename)) {
target = (struct packed_git *)request->userData;
@@ -1024,17 +1027,20 @@ static int fetch_index(unsigned char *sha1)
if (results.curl_result != CURLE_OK) {
free(url);
fclose(indexfile);
+ slot->local = NULL;
return error("Unable to get pack index %s\n%s", url,
curl_errorstr);
}
} else {
free(url);
fclose(indexfile);
+ slot->local = NULL;
return error("Unable to start request");
}
free(url);
fclose(indexfile);
+ slot->local = NULL;
return move_temp_to_file(tmpfile, filename);
}
diff --git a/http-walker.c b/http-walker.c
index 7321ccc..9377851 100644
--- a/http-walker.c
+++ b/http-walker.c
@@ -418,15 +418,18 @@ static int fetch_index(struct walker *walker, struct alt_base *repo, unsigned ch
run_active_slot(slot);
if (results.curl_result != CURLE_OK) {
fclose(indexfile);
+ slot->local = NULL;
return error("Unable to get pack index %s\n%s", url,
curl_errorstr);
}
} else {
fclose(indexfile);
+ slot->local = NULL;
return error("Unable to start request");
}
fclose(indexfile);
+ slot->local = NULL;
return move_temp_to_file(tmpfile, filename);
}
@@ -776,16 +779,19 @@ static int fetch_pack(struct walker *walker, struct alt_base *repo, unsigned cha
run_active_slot(slot);
if (results.curl_result != CURLE_OK) {
fclose(packfile);
+ slot->local = NULL;
return error("Unable to get pack file %s\n%s", url,
curl_errorstr);
}
} else {
fclose(packfile);
+ slot->local = NULL;
return error("Unable to start request");
}
target->pack_size = ftell(packfile);
fclose(packfile);
+ slot->local = NULL;
ret = move_temp_to_file(tmpfile, filename);
if (ret)
--
1.6.3.1
next prev parent reply other threads:[~2009-05-31 9:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-24 16:35 [PATCH 3/3] http-push: send out fetch requests on queue Tay Ray Chuan
2009-05-30 9:17 ` Clemens Buchacher
2009-05-30 9:31 ` Tay Ray Chuan
2009-05-30 9:37 ` Clemens Buchacher
2009-05-30 10:52 ` Tay Ray Chuan
2009-05-30 15:01 ` Tay Ray Chuan
2009-05-30 16:09 ` [PATCH] http*: cleanup slot->local after fclose Tay Ray Chuan
2009-05-30 16:58 ` Clemens Buchacher
2009-05-31 6:17 ` Junio C Hamano
2009-05-31 8:48 ` Tay Ray Chuan
2009-05-31 9:54 ` Tay Ray Chuan [this message]
2009-05-31 20:21 ` [PATCH v2] " Junio C Hamano
2009-06-01 13:52 ` Tay Ray Chuan
2009-06-01 16:13 ` Junio C Hamano
2009-06-02 13:55 ` Tay Ray Chuan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090531175413.962a55c3.rctay89@gmail.com \
--to=rctay89@gmail$(echo .)com \
--cc=Johannes.Schindelin@gmx$(echo .)de \
--cc=drizzd@aon$(echo .)at \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox