From 1f47aa11802271d0b7904b38e59f078b99df2600 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 3 Mar 2016 12:56:03 +0100 Subject: [PATCH] SD log: Fix skipped statistics --- src/modules/sdlog2/sdlog2.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/sdlog2/sdlog2.c b/src/modules/sdlog2/sdlog2.c index 777b0948cd..ed885f224d 100644 --- a/src/modules/sdlog2/sdlog2.c +++ b/src/modules/sdlog2/sdlog2.c @@ -768,10 +768,13 @@ void sdlog2_stop_log() return; } - logging_enabled = false; - + /* disabling the logging will trigger the skipped count to increase, + * so we take a local copy before interrupting the disk I/O. + */ unsigned long skipped_count = log_msgs_skipped; + logging_enabled = false; + /* wake up write thread one last time */ pthread_mutex_lock(&logbuffer_mutex); logwriter_should_exit = true;