Petr Baudis <pasky@xxxxxx> writes: >> > } elsif ($pid == 0) { >> > - if (defined $opts{STDERR}) { >> > - close STDERR; >> > - } >> > if ($opts{STDERR}) { >> > open (STDERR, '>&', $opts{STDERR}) >> > or die "dup failed: $!"; >> >> Indeed. Thanks for pointing that out. > > I'm sorry, I don't follow. Doesn't this just break the STDERR option > altogether as we will try to dup2() over an already open file > descriptor? We do need to close STDERR if we are going to reopen it, > I think. When $opts{STDERR} is 2, what the three lines the proposed patch removes did is actively wrong, because you dup2 the fd you just closed. When $opts{STDERR} is 1, it seems to do the right thing with or without the "close STDERR" in front. Isn't this because the usual "open($fd, <<<anything>>>) closes $fd as necessary" applies to this case as well? So, I am not sure what you are viewing as a problem. Puzzled... -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html