Close write buffer file descriptor before getting the new fs timestamp
This commit is contained in:
parent
4addf65042
commit
c7356c8e9c
|
@ -260,9 +260,11 @@ void write_buffer_to_file(Buffer& buffer, StringView filename)
|
||||||
O_CREAT | O_WRONLY | O_TRUNC, 0644);
|
O_CREAT | O_WRONLY | O_TRUNC, 0644);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
throw file_access_error(filename, strerror(errno));
|
throw file_access_error(filename, strerror(errno));
|
||||||
auto close_fd = on_scope_end([fd]{ close(fd); });
|
|
||||||
|
|
||||||
|
{
|
||||||
|
auto close_fd = on_scope_end([fd]{ close(fd); });
|
||||||
write_buffer_to_fd(buffer, fd);
|
write_buffer_to_fd(buffer, fd);
|
||||||
|
}
|
||||||
|
|
||||||
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