Re: [PATCH 1/2] git_mkstemps: correctly test return value of open()
- From
Thomas Rast <trast@inf.ethz.ch>
- Date
- Jul 16, 2013, 09:37 UTC
- Message-ID
- <878v16kfqy.fsf@linux-k42r.v.cablecom.net>
- In-Reply-To
- <9af38018d55c95a6807d305bb3a088e48916baac.1373618940.git.trast@inf.ethz.ch>
Thomas Rast <trast@inf.ethz.ch> writes:
Show 6 quoted lines
> 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?
Show 16 quoted lines
> 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