From ac2f792d507232d8ddbbdf08f61e974258ba2d8f Mon Sep 17 00:00:00 2001 From: jp9000 Date: Thu, 4 May 2017 18:24:00 -0700 Subject: [PATCH] libobs/util: Flush text files when writing Helps prevent the possibility of an empty file from being written. --- libobs/util/platform.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libobs/util/platform.c b/libobs/util/platform.c index def19fe1b..008cbbb07 100644 --- a/libobs/util/platform.c +++ b/libobs/util/platform.c @@ -248,6 +248,7 @@ bool os_quick_write_mbs_file(const char *path, const char *str, size_t len) if (mbs_len) fwrite(mbs, 1, mbs_len, f); bfree(mbs); + fflush(f); fclose(f); return true; @@ -264,6 +265,7 @@ bool os_quick_write_utf8_file(const char *path, const char *str, size_t len, fwrite("\xEF\xBB\xBF", 1, 3, f); if (len) fwrite(str, 1, len, f); + fflush(f); fclose(f); return true;