Re: [PATCH v3] redir: Handle nested exec within REALLY_CLOSED redirection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 16, 2019 at 10:29:50PM +0000, Harald van Dijk wrote:
>
> Still, if that's slow enough and happens commonly enough that it's worth
> avoiding, it seems like it would still be simpler, shorter and probably
> faster to just write
> 
>   if (fd != -1)
>     close(fd);
> 
> in a few places, since we know that the only invalid fd that ever gets
> passed to close() is -1. That avoids the other cases where dash already
> happily calls close(-1) as well.

The issue is not close(-1), it's close(8) for 8>&- where we already
know that fd 8 was closed to start with (because the first dup
returned -1 on it).

Cheers,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux