]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix errno check based on EINTR in pg_flush_data()
authorMichael Paquier <michael@paquier.xyz>
Thu, 30 Apr 2026 09:44:43 +0000 (18:44 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 30 Apr 2026 09:44:43 +0000 (18:44 +0900)
Upon a failure of sync_file_range(), EINTR was checked based on the
returned result of the routine rather than its errno.  sync_file_range()
returns -1 on failure, making the check a no-op, invalidating the retry
attempt in this case.

Oversight in 0d369ac65004.

Author: DaeMyung Kang <charsyam@gmail.com>
Discussion: https://postgr.es/m/20260429151811.1810874-1-charsyam@gmail.com
Backpatch-through: 16

src/backend/storage/file/fd.c

index 95d8982f88b438658fa9fd5ed17ab7a38e0d863d..6aa6bae5e3737f6b3badb6192b776b358a2e1343 100644 (file)
@@ -562,7 +562,7 @@ retry:
                {
                        int                     elevel;
 
-                       if (rc == EINTR)
+                       if (errno == EINTR)
                                goto retry;
 
                        /*