]> git.ipfire.org Git - thirdparty/xz.git/commit
xz: O_SEARCH cannot be used for fsync()
authorLasse Collin <lasse.collin@tukaani.org>
Sun, 5 Jan 2025 19:43:11 +0000 (21:43 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Sun, 5 Jan 2025 19:43:11 +0000 (21:43 +0200)
commit4014e2479c7b0273f15bd0c9c017c5fe859b0d8f
tree4507f68a474a8f08600a7f721943b943c98786d4
parentad2b57cb477b753293c25a01fc24c7f84ee523c2
xz: O_SEARCH cannot be used for fsync()

Opening a directory with O_SEARCH results in a file descriptor that can
be used with functions like openat(). Such a file descriptor cannot be
used with fsync(). Use O_RDONLY instead.

In musl, O_SEARCH becomes Linux-specific O_PATH. A file descriptor
from O_PATH doesn't allow fsync().

Seems that it's not possible to fsync() a directory that has write
and search permissions but not read permission.

Fixes: 2a9e91d796d091740489d951fa7780525e4275f1
src/xz/file_io.c