From: Thomas Rast <trast@inf.ethz.ch>
To: Junio C Hamano <gitster@pobox.com>,
"Dale R. Worley" <worley@alum.mit.edu>
Cc: <git@vger.kernel.org>
Subject: Re: [PATCH 1/2] git_mkstemps: correctly test return value of open()
Date: Tue, 16 Jul 2013 11:37:09 +0200 [thread overview]
Message-ID: <878v16kfqy.fsf@linux-k42r.v.cablecom.net> (raw)
In-Reply-To: <9af38018d55c95a6807d305bb3a088e48916baac.1373618940.git.trast@inf.ethz.ch> (Thomas Rast's message of "Fri, 12 Jul 2013 10:58:35 +0200")
Thomas Rast <trast@inf.ethz.ch> writes:
> From: "Dale R. Worley" <worley@alum.mit.edu>
>
> open() returns -1 on failure, and indeed 0 is a possible success value
> if the user closed stdin in our process. Fix the test.
>
> Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
I see you have this in 'pu' without Dale's signoff. I'm guessing
(IANAL) that it's too small to be copyrighted and anyway there is only
way to fix it, but maybe Dale can "sign off" just to be safe, anyway?
> wrapper.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/wrapper.c b/wrapper.c
> index dd7ecbb..6a015de 100644
> --- a/wrapper.c
> +++ b/wrapper.c
> @@ -322,7 +322,7 @@ int git_mkstemps_mode(char *pattern, int suffix_len, int mode)
> template[5] = letters[v % num_letters]; v /= num_letters;
>
> fd = open(pattern, O_CREAT | O_EXCL | O_RDWR, mode);
> - if (fd > 0)
> + if (fd >= 0)
> return fd;
> /*
> * Fatal error (EPERM, ENOSPC etc).
--
Thomas Rast
trast@{inf,student}.ethz.ch
next prev parent reply other threads:[~2013-07-16 9:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-12 8:58 [PATCH 0/2] open() error checking Thomas Rast
2013-07-12 8:58 ` [PATCH 1/2] git_mkstemps: correctly test return value of open() Thomas Rast
2013-07-16 9:37 ` Thomas Rast [this message]
2013-07-17 19:29 ` Junio C Hamano
2013-07-18 12:32 ` Drew Northup
2013-07-18 17:46 ` Junio C Hamano
2013-07-18 17:47 ` Junio C Hamano
2013-07-18 20:32 ` Dale R. Worley
2013-07-18 20:49 ` Eric Sunshine
2013-07-18 20:54 ` Junio C Hamano
2013-07-18 22:46 ` Dale R. Worley
2013-07-18 23:23 ` Junio C Hamano
2013-07-18 23:29 ` Dale R. Worley
2013-07-12 8:58 ` [PATCH 2/2] run-command: dup_devnull(): guard against syscalls failing Thomas Rast
2013-07-12 17:29 ` [PATCH 0/2] open() error checking Junio C Hamano
2013-07-16 9:25 ` Thomas Rast
2013-07-16 9:27 ` [PATCH 1/2] daemon/shell: refactor redirection of 0/1/2 from /dev/null Thomas Rast
2013-07-16 9:27 ` [PATCH 2/2] git: ensure 0/1/2 are open in main() Thomas Rast
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=878v16kfqy.fsf@linux-k42r.v.cablecom.net \
--to=trast@inf.ethz.ch \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=worley@alum.mit.edu \
/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.