Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1utTIT-007u6k-HF for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Sep 2025 15:51:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1utTIR-004L1v-DB for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Sep 2025 15:51:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1utTIR-004L1m-3v for pgsql-hackers@lists.postgresql.org; Tue, 02 Sep 2025 15:51:47 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1utTIO-000CId-0g for pgsql-hackers@lists.postgresql.org; Tue, 02 Sep 2025 15:51:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 582FpfZM592102; Tue, 2 Sep 2025 11:51:42 -0400 From: Tom Lane To: Michael Paquier cc: Ning , pgsql-hackers@lists.postgresql.org, Andrew Dunstan Subject: Re: psql client does not handle WSAEWOULDBLOCK on Windows In-reply-to: References: Comments: In-reply-to Michael Paquier message dated "Tue, 10 Dec 2024 15:41:02 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <592100.1756828301.1@sss.pgh.pa.us> Date: Tue, 02 Sep 2025 11:51:41 -0400 Message-ID: <592101.1756828301@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Michael Paquier writes: > This is going to require some platform-specific check that I don't > have with me, though I am ready to accept that what you are telling > here is true and that we should apply this macro. Could somebody > check that a bit more in depth? Andrew D. perhaps? > One thing that I don't understand is why does this only apply after > the first call of pqsecure_raw_read() in gss_read()? There is a > second call of pqsecure_raw_read() you are not covering but it would > surely need the same treatment, no? > Also, what about pqsecure_raw_write() in pqsecure_open_gss()? > Shouldn't the same check apply? Yeah, I think we pretty much need to use SOCK_ERRNO, SOCK_ERRNO_SET, and SOCK_STRERROR (if relevant) throughout fe-secure-gssapi.c. Directly using errno is correct for syscalls related to the file system, but I think everything in this file is dealing with socket-related errors. Certainly the underlying pqsecure_raw_read and pqsecure_raw_write layer expects those macros to be used. Like you, I'm not really in a position to test this on Windows ... regards, tom lane