diff options
Diffstat (limited to 'runtime/os_linux.cc')
| -rw-r--r-- | runtime/os_linux.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/runtime/os_linux.cc b/runtime/os_linux.cc index 22827891b0..675699daea 100644 --- a/runtime/os_linux.cc +++ b/runtime/os_linux.cc @@ -36,6 +36,10 @@ File* OS::OpenFileReadWrite(const char* name) { } File* OS::CreateEmptyFile(const char* name) { + // In case the file exists, unlink it so we get a new file. This is necessary as the previous + // file may be in use and must not be changed. + unlink(name); + return OpenFileWithFlags(name, O_RDWR | O_CREAT | O_TRUNC); } |