Only fall back to writing to the dest file directly in the case of a permission denied when running as root, as root should already have access to all files

This commit is contained in:
Jamie Cameron 2025-03-02 11:12:38 -08:00
parent 37f4fce674
commit c918e6583b

View File

@ -10674,7 +10674,7 @@ else {
my $directopen = 0;
my $tmp = &open_tempfile($file);
my $ex = open($fh, ">$tmp");
if (!$ex && $! =~ /permission/i) {
if (!$ex && $! =~ /permission/i && $< != 0) {
# Could not open temp file .. try opening actual file
# instead directly
$ex = open($fh, ">$file");