summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/file.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/file.cc b/src/file.cc
index 3424afef..8c9705b5 100644
--- a/src/file.cc
+++ b/src/file.cc
@@ -361,7 +361,8 @@ void write_buffer_to_file(Buffer& buffer, StringView filename,
bool replace = method == WriteMethod::Replace;
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;
replace = false;