From 7a35b2d7048669a96256d4ea0086299f8a0cb1df Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 15 Jan 2011 22:42:38 -0800 Subject: [PATCH] altos: Flush log when full When the log storage is full, make sure any pending writes are flushed out so that the last bit isn't lost. Signed-off-by: Keith Packard --- src/ao_log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ao_log.c b/src/ao_log.c index 8666482b..fa072550 100644 --- a/src/ao_log.c +++ b/src/ao_log.c @@ -42,8 +42,8 @@ ao_log_data(__xdata struct ao_log_record *log) __reentrant log->csum = 0; log->csum = ao_log_csum((__xdata uint8_t *) log); ao_mutex_get(&ao_log_mutex); { - if (ao_log_current_pos >= ao_log_end_pos) - ao_log_running = 0; + if (ao_log_current_pos >= ao_log_end_pos && ao_log_running) + ao_log_stop(); if (ao_log_running) { wrote = 1; ao_storage_write(ao_log_current_pos, -- 2.30.2