From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 2C499386EC4B for ; Thu, 11 Mar 2021 14:25:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2C499386EC4B Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-581-8yyhB8XiN0OPEWs40MqKcw-1; Thu, 11 Mar 2021 09:25:16 -0500 X-MC-Unique: 8yyhB8XiN0OPEWs40MqKcw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A770883DEB5; Thu, 11 Mar 2021 14:25:15 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-112-77.ams2.redhat.com [10.36.112.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 97F275D742; Thu, 11 Mar 2021 14:25:14 +0000 (UTC) From: Florian Weimer To: Andreas Schwab Cc: Adhemerval Zanella via Libc-alpha , Adhemerval Zanella Subject: Re: [PATCH 5/8] posix: Do not clobber errno by atfork handlers References: <20210202151134.2123748-1-adhemerval.zanella@linaro.org> <20210202151134.2123748-5-adhemerval.zanella@linaro.org> <87o8fs4mm9.fsf@oldenburg.str.redhat.com> <09b94a9b-905d-db39-3566-767c097f4348@linaro.org> <87eeglizzs.fsf@oldenburg.str.redhat.com> <13c1767e-a4b5-788f-611e-3c660fbceef6@linaro.org> <87czw5ojm9.fsf@igel.home> Date: Thu, 11 Mar 2021 15:25:25 +0100 In-Reply-To: <87czw5ojm9.fsf@igel.home> (Andreas Schwab's message of "Thu, 11 Mar 2021 15:22:38 +0100") Message-ID: <87mtv9hine.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 14:25:20 -0000 * Andreas Schwab: > On M=C3=A4r 11 2021, Adhemerval Zanella via Libc-alpha wrote: > >> But we need to restore it *after* __run_fork_handlers calls. I will >> add the comment to make it explicit: >> >> /* Restore the errno value even if some atfork handler in the parent = =20 >> clobber it. */ > > Perhaps: "If _Fork failed, preserve its errno value." > >> if (pid < 0) >> __set_errno (save_errno) Agreed. And then it's clear it should be moved to the parent branch of the if statement above. Thanks, Florian