Skip to content

Commit

Permalink
Check return value of ftruncate call in http.c
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff Lasslett authored and Junio C Hamano committed Aug 10, 2009
1 parent bb99190 commit 0c4f21e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion http.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit 0c4f21e

Please sign in to comment.