Do not use replace write method when writing to a non-regular file
Fixes #4098
This commit is contained in:
parent
7f8f748d06
commit
8e463e63ea
|
@ -361,7 +361,8 @@ void write_buffer_to_file(Buffer& buffer, StringView filename,
|
||||||
bool replace = method == WriteMethod::Replace;
|
bool replace = method == WriteMethod::Replace;
|
||||||
bool force = flags & WriteFlags::Force;
|
bool force = flags & WriteFlags::Force;
|
||||||
|
|
||||||
if ((replace or force) and ::stat(zfilename, &st) != 0)
|
if ((replace or force) and (::stat(zfilename, &st) != 0 or
|
||||||
|
(sb.st_mode & S_IFMT) != S_IFREG))
|
||||||
{
|
{
|
||||||
force = false;
|
force = false;
|
||||||
replace = false;
|
replace = false;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user