From: Junio C Hamano <gitster@pobox.com>
To: Drew Northup <n1xim.email@gmail.com>
Cc: Thomas Rast <trast@inf.ethz.ch>,
"Dale R. Worley" <worley@alum.mit.edu>,
git@vger.kernel.org, Jonas Fonseca <fonseca@diku.dk>
Subject: Re: [PATCH 1/2] git_mkstemps: correctly test return value of open()
Date: Thu, 18 Jul 2013 10:46:37 -0700 [thread overview]
Message-ID: <7v4nbr4v7m.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <51E7E05E.4000201@gmail.com> (Drew Northup's message of "Thu, 18 Jul 2013 08:32:30 -0400")
Drew Northup <n1xim.email@gmail.com> writes:
> I presume that I should apply this change to my porting of
> git_mkstemps_mode() to tig. If there are no complaints about this for
> a couple of days I will do so.
Hmph, Thomas and I were actually asking you to give us
Signed-off-by: Drew Northup <n1xim.email@gmail.com>
for the patch in question. If tig has the same issue, applying that
same patch there may make sense, but that is an independent issue.
Thanks.
>
> REF: $gmane/229961
>
> On 07/17/2013 03:29 PM, Junio C Hamano wrote:
>> Thomas Rast<trast@inf.ethz.ch> writes:
>>> 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>
>
>>>> 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).
>
>
> --
> -Drew Northup
> --------------------------------------------------------------
> "As opposed to vegetable or mineral error?"
> -John Pescatore, SANS NewsBites Vol. 12 Num. 59
next prev parent reply other threads:[~2013-07-18 17:46 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
2013-07-17 19:29 ` Junio C Hamano
2013-07-18 12:32 ` Drew Northup
2013-07-18 17:46 ` Junio C Hamano [this message]
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7v4nbr4v7m.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=fonseca@diku.dk \
--cc=git@vger.kernel.org \
--cc=n1xim.email@gmail.com \
--cc=trast@inf.ethz.ch \
--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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).