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: Junio C Hamano <gitster@pobox.com> [sp: Use fseek as rewind returns void] Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
parent
e0ab002b50
commit
1be224ba6e
@ -785,8 +785,10 @@ static int handle_commit_msg(struct strbuf *line)
|
|||||||
|
|
||||||
if (use_scissors && is_scissors_line(line)) {
|
if (use_scissors && is_scissors_line(line)) {
|
||||||
int i;
|
int i;
|
||||||
rewind(cmitmsg);
|
if (fseek(cmitmsg, 0L, SEEK_SET))
|
||||||
ftruncate(fileno(cmitmsg), 0);
|
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;
|
still_looking = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user