Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jmObA-0006Pi-Kp for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Jun 2020 21:30:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jmOb9-0003z5-Gz for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Jun 2020 21:30:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jmOb9-0003yy-6N for pgsql-hackers@lists.postgresql.org; Fri, 19 Jun 2020 21:30:55 +0000 Received: from mail-qv1-xf42.google.com ([2607:f8b0:4864:20::f42]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jmOb6-0000oi-Cp for pgsql-hackers@postgresql.org; Fri, 19 Jun 2020 21:30:54 +0000 Received: by mail-qv1-xf42.google.com with SMTP id d12so5195687qvn.0 for ; Fri, 19 Jun 2020 14:30:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=wqu80Crpk8nmcGnTBpC2bn92WGBCrJX0wWPBBIKuNZ0=; b=Y3vaQKZrEBjSxKqxeiVvUsPBYfElKvumuRrmgyPIS3XmX1NHXpF/iYimn0o5PDW03l LcXCpCdW65BtZGqafRXbLp4bYaOg86NNnEDqVpL6HUk3PLmM9NT/OS9MM5HJZMBW4JLY I4+ngjeK1wJxEKyHW4jUyA9GYxjDLWJBRSRXm9Uu1qzSSn3gYiIaOIXwNMI86Vw+vKqG KWW8rvZyBWdkQzkipZrzeUv6hxNF9mEf9E/jvRwDkGxggZWXyA1LxhKJU6dfoBcoRFT2 nAMJ3JcOkDpIuXmnZPm3k4+7YBPi1cSKwlmVNWHjfljNq7mCOH+CDDFqk/2OZvVfA73u jh0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=wqu80Crpk8nmcGnTBpC2bn92WGBCrJX0wWPBBIKuNZ0=; b=WC2q2y3XF7zqTVPZ6MqxXJTGL/FgqdQzQL5Ph68MRQcq/E1zAQtUAf9+ijonDMtI/M 8aFF2VVATsNP6rMTGq8yME8Tdpj3FCxcKWyyHHS11BYROCTD8WGvjo+MKVoQjCMawsuj 729ZBGwU5W5OTN+5lpBucl48/604JVh/O3b+wPv7d/pF0AHxCh/3sX/vwTEtRgyJyiA0 4fKvcbQKarXCutc4LGPaC4uOsZTqsy11OERszVmq/fSklOodIPUohUt6ZlugNu8ehNUt lFQsQJJso54m0q467lpNMjWGi7FVkICOiLib7CjmzNRkjLr0ckGrOni+nQbnSXHc11lZ ar2w== X-Gm-Message-State: AOAM532QvEpvy3rKl+DiuLdeEzoDo5dLxMm0brKdnb2GrzTNSM9Cz3+H gjpvyvmdym4CdlOrwoeSPQBoyA== X-Google-Smtp-Source: ABdhPJxB4NJLz6P+q6j4DDIgrsDUslwzk+nYw53gUXdck3lCJ/FjtCcMSceRt1SftMDLmgSz+Djnsg== X-Received: by 2002:a0c:e952:: with SMTP id n18mr10821434qvo.147.1592602250160; Fri, 19 Jun 2020 14:30:50 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.18.252]) by smtp.gmail.com with ESMTPSA id l69sm6639458qke.112.2020.06.19.14.30.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2020 14:30:49 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 442B02A3D8C; Fri, 19 Jun 2020 17:30:47 -0400 (-04) Date: Fri, 19 Jun 2020 17:30:47 -0400 From: Alvaro Herrera To: Tom Lane Cc: Justin Pryzby , pgsql-hackers@postgresql.org, Kunshchikov Vladimir Subject: Re: pg_dump, gzwrite, and errno Message-ID: <20200619213047.GA7048@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1597085.1592515818@sss.pgh.pa.us> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Jun-18, Tom Lane wrote: > Surely it's insufficient as-is, because there is no reason to suppose > that errno is zero at entry. You'd need to set errno = 0 first. Oh, right. > Also it's fairly customary in our sources to include a comment about > this machination; so the full ritual is usually more like Yeah, I had that in my local copy. Done like that in all the most obvious places. But there are more places that are still wrong: I believe every single place that calls WRITE_ERROR_EXIT is doing the wrong thing. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services