Re: dup2() vs dup3() inconsistency when

From: Bernd Petrovitsch
Date: Fri Oct 10 2008 - 09:32:47 EST


On Fri, 2008-10-10 at 15:15 +0200, Michael Kerrisk wrote:
> On Fri, Oct 10, 2008 at 3:02 PM, Bernd Petrovitsch <bernd@xxxxxxxxx> wrote:
[....]
> >> but to eliminate the blemish in its design in the new dup3() (since we
> >> have alrady eliminated one other blemish).
> >
> > FWIW I consider the automatic close() in dup2() a feature (if only that
> > it avoids an additional system call).
>
> Exploiting this "feature" can hide real errors that would be detected
> if one does an explicit close(). (See the dup2 man page.)

If someone is interested in the return value of the automatic close(),
he/she can call close() anyways and check the the result.

Bernd
--
Firmix Software GmbH http://www.firmix.at/
mobil: +43 664 4416156 fax: +43 1 7890849-55
Embedded Linux Development and Services


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/