diff options
author | Jeff Lasslett <jeff.lasslett@gmail.com> | 2009-08-11 00:05:06 +0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-08-10 13:26:18 -0700 |
commit | 0c4f21e452dca5a705c36ca7e363c1a3b3c2a5b8 (patch) | |
tree | 7be97ff7393e02911da923360494477dda59389d /http.c | |
parent | bb99190e27c455867bb364059f9a44c0571fc914 (diff) | |
download | git-0c4f21e452dca5a705c36ca7e363c1a3b3c2a5b8.tar.gz |
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.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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; + } } } |