From: Petr Baudis <pasky@ucw.cz>
To: Thomas Rast <trast@inf.ethz.ch>
Cc: Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org, Eric Wong <normalperson@yhbt.net>,
Marcin Owsiany <marcin@owsiany.pl>
Subject: Re: [PATCH v2 1/2] perl: redirect stderr to /dev/null instead of closing
Date: Sat, 6 Apr 2013 12:34:26 +0200 [thread overview]
Message-ID: <20130406103426.GE6137@machine.or.cz> (raw)
In-Reply-To: <878v4wrsj7.fsf@linux-k42r.v.cablecom.net>
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 is probably what you were referring to.
Yes, that's probably one reason why I had this stuck in my mind (though,
how often does anyone bother to detect errors on close()...? ;-).
Funnily enough, POSIX.2008 specifies that if closing newfd would fail,
dup2() reports EIO and newfd is not closed, eliminating this problem.
The manpage does not cover this; well, that's fair enough as Linux just
doesn't care and never does that if I didn't miss anything in the code.
--
Petr "Pasky who might even send
a patch, but the matter is
oh so obscure" Baudis
next prev parent reply other threads:[~2013-04-06 17:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-03 22:26 [PATCH] perl: redirect stderr to /dev/null instead of closing Thomas Rast
2013-04-04 1:16 ` Eric Wong
2013-04-04 20:41 ` [PATCH v2 1/2] " Thomas Rast
2013-04-04 21:14 ` Eric Wong
2013-04-05 14:48 ` Petr Baudis
2013-04-05 18:57 ` Junio C Hamano
2013-04-05 23:34 ` Petr Baudis
2013-04-06 8:07 ` Thomas Rast
2013-04-06 10:34 ` Petr Baudis [this message]
2013-04-04 20:41 ` [PATCH v2 2/2] t9700: do not close STDERR Thomas Rast
2013-04-04 21:11 ` Jonathan Nieder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130406103426.GE6137@machine.or.cz \
--to=pasky@ucw.cz \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=marcin@owsiany.pl \
--cc=normalperson@yhbt.net \
--cc=trast@inf.ethz.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.