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

2013-04-06 Thread Thomas Rast
Petr Baudis pa...@ucw.cz 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

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. which

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-05 Thread Junio C Hamano
Petr Baudis pa...@ucw.cz writes: } elsif ($pid == 0) { - if (defined $opts{STDERR}) { - close STDERR; - } if ($opts{STDERR}) { open (STDERR, '', $opts{STDERR})

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

2013-04-04 Thread Thomas Rast
On my system, t9100.1 triggers the following warning: ==352== Syscall param write(buf) points to uninitialised byte(s) ==352==at 0x57119C0: __write_nocancel (in /lib64/libc-2.17.so) ==352==by 0x56AC1D2: _IO_file_write@@GLIBC_2.2.5 (in /lib64/libc-2.17.so) ==352==by 0x56AC0B1:

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

2013-04-04 Thread Eric Wong
Thomas Rast tr...@inf.ethz.ch 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 tr...@inf.ethz.ch Acked-by: Eric Wong normalper...@yhbt.net Thanks. -- To unsubscribe from this