summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2015-10-02 17:13:49 +0200
committerLemonBoy <thatlemon@gmail.com>2015-10-02 17:21:17 +0200
commitdb5ae4adce6ad82150a4fef01c8b141631f89d96 (patch)
tree310c3d1cd251b64bb3974890c7460680b8438ad8 /src/core
parentacbe2ecac299d4f6770c60747776cbea290bee3f (diff)
downloadirssi-db5ae4adce6ad82150a4fef01c8b141631f89d96.zip
Flush the dirty buffer to disk
Given a big enough write_buffer_size and a long enough write_buffer_timeout it might be possible to show the user an incomplete or empty awaylog. Patch by: Petteri Aimonen
Diffstat (limited to 'src/core')
-rw-r--r--src/core/log-away.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core/log-away.c b/src/core/log-away.c
index 681edcbf..c6de721c 100644
--- a/src/core/log-away.c
+++ b/src/core/log-away.c
@@ -62,6 +62,9 @@ static void awaylog_open(void)
return;
}
+ /* Flush the dirty buffers to disk before acquiring the file position */
+ write_buffer_flush();
+
awaylog = log;
away_filepos = lseek(log->handle, 0, SEEK_CUR);
away_msgs = 0;
@@ -83,6 +86,9 @@ static void awaylog_close(void)
if (awaylog == log) awaylog = NULL;
+ /* Flush the dirty buffers to disk before showing the away log */
+ write_buffer_flush();
+
signal_emit("awaylog show", 3, log, GINT_TO_POINTER(away_msgs),
GINT_TO_POINTER(away_filepos));
log_close(log);