]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix handling of copy_file_range() return value
authorPeter Eisentraut <peter@eisentraut.org>
Mon, 29 Jun 2026 09:49:11 +0000 (11:49 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Mon, 29 Jun 2026 10:29:21 +0000 (12:29 +0200)
commit994f770a0fd55dfdeb96d1d60d35545ba2d51480
tree0e97df7dbf6b280c02f355890bd04046404a5780
parentb7e4e3e7fa73458ecca5cd10f341743fd12a4faa
Fix handling of copy_file_range() return value

Treat copy_file_range() return value of zero as an error: it indicates
that no bytes could be copied (perhaps the source file is shorter than
expected), and the existing retry loop would otherwise spin forever
since nwritten would never reach BLCKSZ.

The other uses of copy_file_range() in the tree don't have this
problem.

Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Reviewed-by: Yingying Chen <cyy9255@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/3208cf7a-c7f3-41eb-92f6-33cbeff4df40%40eisentraut.org
src/bin/pg_combinebackup/reconstruct.c