From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 550E43858D20 for ; Thu, 28 Sep 2023 13:32:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 550E43858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 8ED141FD69; Thu, 28 Sep 2023 13:32:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1695907951; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ukq3wlfkW9VNGDuQEnMS0pINavidhDz6BUF5nUWOGxY=; b=g5aUaTpoLXPmB+zk7YiB0mKDrdYrWkqhWscUPzGpjYr/Xib3zkn4zz82mpdg2w97uljW4H b/YpJT0332i8XuLPpLMl5pQH0uO+UsCG/93NxKE/a6A4g8bt/yMS65FVD5yVBZcJoSR/2I XKiNc9YmXwolp+lA/BFAeUk0GW9lfO8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1695907951; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ukq3wlfkW9VNGDuQEnMS0pINavidhDz6BUF5nUWOGxY=; b=emKLrhQIPGe31aH3eKstkAdJpgiDS0K2QPFNVFaQHspC/+ThL3JGbjT4Mb9KtQVUEDB6Yb LvzBVQVqItMBDQDA== Received: from hawking.nue2.suse.org (unknown [10.168.4.11]) by relay2.suse.de (Postfix) with ESMTP id 708F22C142; Thu, 28 Sep 2023 13:32:31 +0000 (UTC) Received: by hawking.nue2.suse.org (Postfix, from userid 17005) id 7CB394A0399; Thu, 28 Sep 2023 15:32:31 +0200 (CEST) From: Andreas Schwab To: Joe Simmons-Talbott Cc: libc-alpha@sourceware.org Subject: Re: [PATCH] nss: Get rid of alloca usage in makedb's write_output. In-Reply-To: <20230928131432.GB4098455@oak> (Joe Simmons-Talbott's message of "Thu, 28 Sep 2023 09:14:32 -0400") References: <20230926135528.3517253-1-josimmon@redhat.com> <20230928131432.GB4098455@oak> X-Yow: Is there something I should be DOING with a GLAZED DONUT?? Date: Thu, 28 Sep 2023 15:32:31 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Sep 28 2023, Joe Simmons-Talbott wrote: > On Thu, Sep 28, 2023 at 01:16:00PM +0200, Andreas Schwab wrote: >> On Sep 26 2023, Joe Simmons-Talbott wrote: >> >> > @@ -802,6 +812,7 @@ write_output (int fd) >> > assert (iov_nelts <= INT_MAX); >> > if (writev (fd, iov, iov_nelts) != keydataoffset) >> > { >> > + scratch_buffer_free (&sbuf); >> > error (0, errno, gettext ("failed to write new database file")); >> > return EXIT_FAILURE; >> >> Does scratch_buffer_free guarantee that errno is not changed? > > scratch_buffer_free doesn't do anything other than call free when the > buffer has been heap-allocated. IIUC free preserves errno since 2.33 in > the default free. So I guess if there is a non-default free that > doesn't preserve errno then there is no explicit guarantee. Should I > adjust scratch_buffer_free to explicitly preserve errno (in a separate > patch) or just preserve errno around this one call to > scratch_buffer_free? You could just move the call down. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."