Re: [PATCH v2 1/2] perl: redirect stderr to /dev/null instead of closing

2013-04-06 Thread Petr Baudis
On Sat, Apr 06, 2013 at 10:07:40AM +0200, Thomas Rast wrote: > The manpage for dup2 does, however, say > >If newfd was open, any errors that would have been reported at >close(2) time are lost. A careful programmer will not use dup2() or >dup3() without closing newfd first. > >

Re: [PATCH v2 1/2] perl: redirect stderr to /dev/null instead of closing

2013-04-06 Thread Thomas Rast
Petr Baudis writes: > On Fri, Apr 05, 2013 at 11:57:19AM -0700, Junio C Hamano wrote: > The thing is, I was confused about dup2() all along as my old UNIX > masters taught me that I must close() the original descriptor first > and since that's what's commonly done anyway, I never thought to > d

Re: [PATCH v2 1/2] perl: redirect stderr to /dev/null instead of closing

2013-04-05 Thread Petr Baudis
On Fri, Apr 05, 2013 at 11:57:19AM -0700, Junio C Hamano wrote: > Petr Baudis writes: > >> > -if (defined $opts{STDERR}) { > >> > -close STDERR; > >> > -} > >> > if ($opts{STDERR}) { > >> >

Re: [PATCH v2 1/2] perl: redirect stderr to /dev/null instead of closing

2013-04-05 Thread Junio C Hamano
Petr Baudis writes: >> >} elsif ($pid == 0) { >> > - if (defined $opts{STDERR}) { >> > - close STDERR; >> > - } >> >if ($opts{STDERR}) { >> >open (STDERR, '>&', $opts{STDERR}) >>

Re: [PATCH v2 1/2] perl: redirect stderr to /dev/null instead of closing

2013-04-05 Thread Petr Baudis
Hi! On Thu, Apr 04, 2013 at 10:41:41PM +0200, Thomas Rast wrote: > As pointed out by Eric Wong (thanks), the initial close needs to go: > die() would again write nowhere if we close STDERR beforehand. > > > Perhaps we should also do the following: > > > > --- a/perl/Git.pm > > +++ b/perl/Git.pm

Re: [PATCH v2 1/2] perl: redirect stderr to /dev/null instead of closing

2013-04-04 Thread Eric Wong
Thomas Rast wrote: > As pointed out by Eric Wong (thanks), the initial close needs to go: > die() would again write nowhere if we close STDERR beforehand. > > Signed-off-by: Thomas Rast Acked-by: Eric Wong Thanks. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of