提交 0c4f21e4 编写于 作者: J Jeff Lasslett 提交者: 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: NJeff Lasslett <jeff.lasslett@gmail.com>
Signed-off-by: NTay Ray Chuan <rctay89@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册