X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=http-fetch.c;h=b12779dcb4a1ce92db94f545e1b78d7ea8b098e0;hb=50496b2170cbe87b4c13f89f274aa2f181522bb9;hp=a1b03cd9c842e9daa8f743939d4382faac0c534f;hpb=1301c6eb412e7c5511b952a12e42c70ad56f028b;p=git.git diff --git a/http-fetch.c b/http-fetch.c index a1b03cd9..b12779dc 100644 --- a/http-fetch.c +++ b/http-fetch.c @@ -520,12 +520,17 @@ static void start_request(struct transfer_request *request) static void finish_request(struct transfer_request *request) { + struct stat st; + fchmod(request->local, 0444); close(request->local); if (request->http_code == 416) { fprintf(stderr, "Warning: requested range invalid; we may already have all the data.\n"); } else if (request->curl_result != CURLE_OK) { + if (stat(request->tmpfile, &st) == 0) + if (st.st_size == 0) + unlink(request->tmpfile); return; }