]> git.ipfire.org Git - thirdparty/util-linux.git/commit
hardlink: preserve timestamps when reflinking files
authorLiu Zheng <liuzheng@uniontech.com>
Tue, 2 Jun 2026 06:26:28 +0000 (14:26 +0800)
committerLiu Zheng <liuzheng@uniontech.com>
Tue, 2 Jun 2026 06:31:03 +0000 (14:31 +0800)
commit1659125a2274492021ff91feee8a921f22921b28
tree13119c835bb987921a7ddd738e962affb3c6f129
parent4caa4707285580f003de44a8caf0d0c9852e9be5
hardlink: preserve timestamps when reflinking files

When using --reflink=always, the destination file gets the current
timestamp instead of preserving the original file's atime and mtime.
This differs from both hardlink behavior and "cp -p --reflink=always".

Add futimens() call after successful reflink to restore the original
timestamps from the target file's stat data.

Fixes #2340
misc-utils/hardlink.c