]> git.ipfire.org Git - thirdparty/util-linux.git/commit
exch: fix compile error if renameat2 is not present
authorThomas Devoogdt <thomas.devoogdt@barco.com>
Thu, 6 Mar 2025 13:18:48 +0000 (14:18 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 10 Mar 2025 13:49:53 +0000 (14:49 +0100)
commit8bbe13bf08de95101ff4fd16576db039e27a4123
tree608ec390a46ad9e11a69fe76b46a29876aff8bec
parentc19f6dc3cc121ef707b5128615b89bb3c64ca432
exch: fix compile error if renameat2 is not present

https://www.man7.org/linux/man-pages/man2/rename.2.html
Available since Linux 3.15 or glibc 2.28,
add a fallback for older systems.

My initial implementation did the exchange using a swap
file if both HAVE_RENAMEAT2 and SYS_renameat2 were absent.
But that is not really what is desired since exch is supposed
to be atomic. So simply return -1 renameat2 is available.

Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
(cherry picked from commit 72a99516f7bdf72411501d0a04cc8f8a7e562d10)
misc-utils/exch.c