mirror of
https://github.com/git/git.git
synced 2024-11-20 04:24:01 +01:00
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>
This commit is contained in:
parent
bb99190e27
commit
0c4f21e452
6
http.c
6
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user