From: "Shawn O. Pearce" <spearce@spearce.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/2] builtin-mailinfo.c: check error status from rewind and ftruncate
Date: Tue, 29 Sep 2009 09:40:46 -0700 [thread overview]
Message-ID: <20090929164046.GB25756@spearce.org> (raw)
In-Reply-To: <1254206409-13256-1-git-send-email-gitster@pobox.com>
Junio C Hamano <gitster@pobox.com> wrote:
> 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.
...
> 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))
Uh...
builtin-mailinfo.c: In function 'handle_commit_msg':
builtin-mailinfo.c:788: error: void value not ignored as it ought to be
I think you mean to squash this in, and use fseek instead:
diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index 3306d9e..c90cd31 100644
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
@@ -785,7 +785,7 @@ static int handle_commit_msg(struct strbuf *line)
if (use_scissors && is_scissors_line(line)) {
int i;
- if (rewind(cmitmsg))
+ 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");
--
Shawn.
prev parent reply other threads:[~2009-09-29 16:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Shawn O. Pearce [this message]
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=20090929164046.GB25756@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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 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.