From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH 1/2] builtin-mailinfo.c: check error status from rewind and ftruncate
Date: Mon, 28 Sep 2009 23:40:08 -0700 [thread overview]
Message-ID: <1254206409-13256-1-git-send-email-gitster@pobox.com> (raw)
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
next reply other threads:[~2009-09-29 6:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-29 6:40 Junio C Hamano [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1254206409-13256-1-git-send-email-gitster@pobox.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).