From: Jeff Lasslett Date: Mon, 10 Aug 2009 16:05:06 +0000 (+0800) Subject: Check return value of ftruncate call in http.c X-Git-Tag: v1.6.5-rc0~87 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0c4f21e452dca5a705c36ca7e363c1a3b3c2a5b8;p=git.git 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 Signed-off-by: Tay Ray Chuan Signed-off-by: Junio C Hamano --- diff --git a/http.c b/http.c index 98f970762..14d535747 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; + } } }