summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorJeff Lasslett <jeff.lasslett@gmail.com>2009-08-10 16:05:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-08-10 20:26:18 (GMT)
commit0c4f21e452dca5a705c36ca7e363c1a3b3c2a5b8 (patch)
tree7be97ff7393e02911da923360494477dda59389d /http.c
parentbb99190e27c455867bb364059f9a44c0571fc914 (diff)
downloadgit-0c4f21e452dca5a705c36ca7e363c1a3b3c2a5b8.zip
git-0c4f21e452dca5a705c36ca7e363c1a3b3c2a5b8.tar.gz
git-0c4f21e452dca5a705c36ca7e363c1a3b3c2a5b8.tar.bz2
Check return value of ftruncate call in http.c
In new_http_object_request(), check ftruncate() call return value and handle possible errors. Signed-off-by: Jeff Lasslett <jeff.lasslett@gmail.com> Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http.c')
-rw-r--r--http.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/http.c b/http.c
index 98f9707..14d5357 100644
--- a/http.c
+++ b/http.c
@@ -1187,7 +1187,11 @@ struct http_object_request *new_http_object_request(const char *base_url,
if (prev_posn>0) {
prev_posn = 0;
lseek(freq->localfile, 0, SEEK_SET);
- ftruncate(freq->localfile, 0);
+ if (ftruncate(freq->localfile, 0) < 0) {
+ error("Couldn't truncate temporary file %s for %s: %s",
+ freq->tmpfile, freq->filename, strerror(errno));
+ goto abort;
+ }
}
}