提交 1be224ba 编写于 作者: J Junio C Hamano 提交者: Shawn O. Pearce

builtin-mailinfo.c: check error status from rewind and ftruncate

A recent "cut at scissors" implementation rewinds and truncates
the output file to store the message when it sees a scissors mark,
but it did not check if these library calls succeeded.
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
[sp: Use fseek as rewind returns void]
Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
上级 e0ab002b
......@@ -785,8 +785,10 @@ static int handle_commit_msg(struct strbuf *line)
if (use_scissors && is_scissors_line(line)) {
int i;
rewind(cmitmsg);
ftruncate(fileno(cmitmsg), 0);
if (fseek(cmitmsg, 0L, SEEK_SET))
die_errno("Could not rewind output message file");
if (ftruncate(fileno(cmitmsg), 0))
die_errno("Could not truncate output message file at scissors");
still_looking = 1;
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册