Check the return value of the rename call
This commit is contained in:
parent
4dae2c875b
commit
89cd68d8af
|
@ -335,8 +335,8 @@ void write_buffer_to_file(Buffer& buffer, StringView filename,
|
||||||
::fsync(fd);
|
::fsync(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (replace)
|
if (replace and rename(temp_filename, zfilename) != 0)
|
||||||
rename(temp_filename, zfilename);
|
throw runtime_error("replacing file failed");
|
||||||
|
|
||||||
if ((buffer.flags() & Buffer::Flags::File) and
|
if ((buffer.flags() & Buffer::Flags::File) and
|
||||||
real_path(filename) == real_path(buffer.name()))
|
real_path(filename) == real_path(buffer.name()))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user