All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] builtin-mailinfo.c: check error status from rewind and ftruncate
@ 2009-09-29  6:40 Junio C Hamano
  2009-09-29  6:40 ` [PATCH 2/2] fast-import.c::validate_raw_date(): really validate the value Junio C Hamano
  2009-09-29 16:40 ` [PATCH 1/2] builtin-mailinfo.c: check error status from rewind and ftruncate Shawn O. Pearce
  0 siblings, 2 replies; 3+ messages in thread
From: Junio C Hamano @ 2009-09-29  6:40 UTC (permalink / raw)
  To: git

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>
---
 builtin-mailinfo.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index d498b1c..3306d9e 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 (rewind(cmitmsg))
+			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;
 
 		/*
-- 
1.6.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-09-29 16:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-29  6:40 [PATCH 1/2] builtin-mailinfo.c: check error status from rewind and ftruncate Junio C Hamano
2009-09-29  6:40 ` [PATCH 2/2] fast-import.c::validate_raw_date(): really validate the value Junio C Hamano
2009-09-29 16:40 ` [PATCH 1/2] builtin-mailinfo.c: check error status from rewind and ftruncate Shawn O. Pearce

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.