X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type; q=dns; s=default; b=QI9kJ5 ZXgzeVCHE/bxm+gnNU8xToOfmq8ZQV2ERURnsP5iJ7x+D41CK/Dn8rvY8/WWiK6v 7ahulOG65A7n+DyA9aJH3VNC+hI0T4lILLY977ZWCoGLfINQaVpv6Xrhhqp3ELIu nkoXTlo0i1EocAx0GF5hoiZwwxqVRNXJhM148= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type; s=default; bh=ncHSJIieluS3 m6m03YmI90MSnuE=; b=fpWqglSbJGZ6rSeBUSJDX0jrYvXkRfPLaLWgEvt/N79S G6ThC+XCq2BsexDCOJedqJ6mcti2dZvsTFBGRPRnfOWDRC3YcZhe5N6zAK13rD3H 98VTk9ULNlaas3PbTnCoQInKM0ZEYPCzvHcna8v+cVZC88qskHh/jjwRjbCsTV0= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Message-ID: <53E238D2.1030404@redhat.com> Date: Wed, 06 Aug 2014 08:16:50 -0600 From: Eric Blake User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: syslog function: Bad file descriptor References: <53E10628 DOT 3C42FD6F AT boland DOT nl> <20140805164842 DOT GA13601 AT calimero DOT vinschen DOT de> <53E117B7 DOT 4C81186A AT boland DOT nl> <20140805190014 DOT GD13601 AT calimero DOT vinschen DOT de> <53E13FFE DOT E7A33C0D AT boland DOT nl> <20140806091941 DOT GK13601 AT calimero DOT vinschen DOT de> <53E211DD DOT 12F8D5C8 AT boland DOT nl> In-Reply-To: <53E211DD.12F8D5C8@boland.nl> OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="AmLTFsGEwJmBiN0kkBVdxeAIGttVW3Tf9" X-IsSubscribed: yes --AmLTFsGEwJmBiN0kkBVdxeAIGttVW3Tf9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 08/06/2014 05:30 AM, D. Boland wrote: >> Without looking into the sources, I'd assume there's a closelog() >> call missing prior to the descriptor close orgy. This closelog() >> call should fix the problem. >=20 > It is exactly as you say. I found the close() orgy and put a closelog() p= rior to it. > Now it works perfectly without corrupting the aliases file (writable to s= endmail). >=20 > I'm asking myself if this closing of 253 file descriptors is a sensible t= hing to do. Maybe. There's two schools of thoughts about preventing unintended actions due to accidentally leaked fds: 1. any time a parent forks an unknown child, the parent does an orgy close() between fork() and exec() so that the child starts life clean. 2. any time a child starts from an unknown parent, the child starts with an orgy close() to ensure it starts life clean. [More recently, there is the addition of O_CLOEXEC to open() and other APIs to allow atomic FD_CLOEXEC setting, and then you can avoid the orgy close() in style 1; but that still doesn't stop style 2 paranoid children] > What would Sendmail be trying to accomplish there? It comments "Be shure = we have > enough file descriptors". And: "in 4.4BSD, the table ([of fd's]) can be h= uge; impose > a reasonable limit". Bizarre. Other programs that I know do an orgy close() on startup: bash, tcsh. So it's not uncommon. But if you do it first, it MUST be first - before you open any fds that must not be accidentally closed. sendmail is indeed buggy for trying to use syslog() (which uses an fd) prior to doing the orgy close. >=20 > Could it be that incoming e-mail is such a volatile process that previous= opened > file descriptors are not closed quick enough? This feels like a crude hac= k. Just because the problem hasn't tripped other platforms does not make it any less of an upstream sendmail bug. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --AmLTFsGEwJmBiN0kkBVdxeAIGttVW3Tf9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJT4jjSAAoJEKeha0olJ0NqbuQIAIJwkxLT26zxfDLnLSZK2gEW NBHmWpJVACiyXEa8cJH72Z7tNWI/E6R+BDVq35Vf649NWc/21dJpjTDfb7d++QXJ 2eG6BIU06mEsZszCd8EVzEuVhrCiSUboneXvnjf0LIYeU2GJFzBRbfj/zJjVMSie 7O31I9o+vyd1Vh0hZ3b1V+BsMWPK2/Is2IYM7oNWuJkX7X13hb0KK+Kdx0WMhnx2 ayXQE/Qoq0aC9U2mdvLQhWEN6EfKgAv3Ig9OCTVXuy6wRYHsUbQWL6Q8GNRl3Dfo vyLlrquXGJPhRK/t4HXGdUeplHnHsD8agQ04qqnj41dQduYMf4c4I5LeuDPvOsA= =QcYZ -----END PGP SIGNATURE----- --AmLTFsGEwJmBiN0kkBVdxeAIGttVW3Tf9--