Commit 0c4f21e4 authored by Jeff Lasslett's avatar Jeff Lasslett Committed by Junio C Hamano

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: default avatarJeff Lasslett <[email protected]>
Signed-off-by: Ray's avatarTay Ray Chuan <[email protected]>
Signed-off-by: default avatarJunio C Hamano <[email protected]>
parent bb99190e
......@@ -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;
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment