]> git.ipfire.org Git - thirdparty/libarchive.git/commit
Create temporary files in the target directory 2753/head
authorDag-Erling Smørgrav <des@des.no>
Tue, 14 Oct 2025 00:11:31 +0000 (02:11 +0200)
committerDag-Erling Smørgrav <des@des.no>
Wed, 15 Oct 2025 07:41:06 +0000 (09:41 +0200)
commit1c08abc60d6db60ea742e2e2c4028c1ee388c9d2
tree67e7da36769f8ae94a92a89127d8576b985a2e65
parentd0f69b355df45a86e90b4eaf9cebeb63c4c5e5d4
Create temporary files in the target directory

Whenever we need to create a temporary file while writing to disk on a
POSIX system, try to create it in the same directory as the final file
instead of the current working directory.  The target directory can
reasonably be expected to be writable (and if it isn't, creating the
file will fail anyway), but the current working directory may not be.

While here, consistently use __archive_mkstemp(), and increase the
template from six to eight random characters.

Fixes: 2e73ea3a7db1 ("Fix max path-length metadata writing (#2243)")
Fixes: e12c955dca63 ("Unify temporary directory handling")
libarchive/archive_read_disk_entry_from_file.c
libarchive/archive_write_disk_posix.c