1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-18 17:02:06 +03:00

Check the return value of the rename call

This commit is contained in:
Maxime Coste 2019-02-12 21:05:47 +11:00
parent 4dae2c875b
commit 89cd68d8af

View File

@ -335,8 +335,8 @@ void write_buffer_to_file(Buffer& buffer, StringView filename,
::fsync(fd);
}
if (replace)
rename(temp_filename, zfilename);
if (replace and rename(temp_filename, zfilename) != 0)
throw runtime_error("replacing file failed");
if ((buffer.flags() & Buffer::Flags::File) and
real_path(filename) == real_path(buffer.name()))