From eafd8d91d77aaa0c5dfdd5cdd7b228bc5c284053 Mon Sep 17 00:00:00 2001 From: Themaister Date: Tue, 23 Aug 2011 21:04:00 +0200 Subject: [PATCH] Avoid spamming down stderr with autosave messages. --- autosave.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/autosave.c b/autosave.c index 1b2d37db04..87101dc6e0 100644 --- a/autosave.c +++ b/autosave.c @@ -42,6 +42,9 @@ struct autosave static int autosave_thread(void *data) { autosave_t *save = data; + + bool first_log = true; + while (!save->quit) { autosave_lock(save); @@ -52,7 +55,13 @@ static int autosave_thread(void *data) FILE *file = fopen(save->path, "wb"); if (file) { - SSNES_LOG("Autosaving SRAM to \"%s\"\n", save->path); + // Avoid spamming down stderr ... :) + if (first_log) + { + SSNES_LOG("Autosaving SRAM to \"%s\", will continue to autosave every %u seconds ...\n", save->path, save->interval); + first_log = false; + } + bool failed = false; failed |= fwrite(save->buffer, 1, save->bufsize, file) != save->bufsize; failed |= fflush(file) != 0;