summaryrefslogtreecommitdiff
path: root/builtin-mailinfo.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2009-09-28 23:40:08 -0700
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2009-09-29 09:40:55 -0700
commit1be224ba6e99f0ab34c998d7fa8023b76a15c8b6 (patch)
tree7493971022bf149944844100b1e34379215e9b75 /builtin-mailinfo.c
parentMake just opening the generated MSVC solution file not modify it (diff)
downloadtgif-1be224ba6e99f0ab34c998d7fa8023b76a15c8b6.tar.xz
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>
Diffstat (limited to 'builtin-mailinfo.c')
-rw-r--r--builtin-mailinfo.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index d498b1cd2d..c90cd312ac 100644
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
@@ -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;
/*