libdlog: fix broken limiter with static config 22/191222/1
authorMichal Bloch <m.bloch@samsung.com>
Fri, 12 Oct 2018 14:23:39 +0000 (16:23 +0200)
committerMichal Bloch <m.bloch@samsung.com>
Fri, 12 Oct 2018 14:34:34 +0000 (16:34 +0200)
Change-Id: I0ecd8c3327ac12133aa2beb402bc1c52d598926b
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
src/libdlog/log.c

index 1f3c3ea..3139308 100644 (file)
@@ -213,25 +213,24 @@ static int dlog_should_log(log_id_t log_id, int prio, const char *tag)
        if (log_id <= LOG_ID_INVALID || LOG_ID_MAX <= log_id)
                return DLOG_ERROR_INVALID_PARAMETER;
 
-       if (dynamic_config) {
+       if (dynamic_config)
                __dynamic_config_update();
 
-               // LCOV_EXCL_START : disabled feature (limiter)
-               if (limiter) {
-                       pthread_mutex_lock(&log_init_lock);
-                       int should_log = __log_limiter_pass_log(tag, prio);
-                       pthread_mutex_unlock(&log_init_lock);
-
-                       if (!should_log) {
-                               return DLOG_ERROR_NOT_PERMITTED;
-                       } else if (should_log < 0) {
-                               write_to_log(log_id, prio, tag,
-                                               "Your log has been blocked due to limit of log lines per minute.");
-                               return DLOG_ERROR_NOT_PERMITTED;
-                       }
+       // LCOV_EXCL_START : disabled feature (limiter)
+       if (limiter) {
+               pthread_mutex_lock(&log_init_lock);
+               int should_log = __log_limiter_pass_log(tag, prio);
+               pthread_mutex_unlock(&log_init_lock);
+
+               if (!should_log) {
+                       return DLOG_ERROR_NOT_PERMITTED;
+               } else if (should_log < 0) {
+                       write_to_log(log_id, prio, tag,
+                                       "Your log has been blocked due to limit of log lines per minute.");
+                       return DLOG_ERROR_NOT_PERMITTED;
                }
-               // LCOV_EXCL_STOP
        }
+       // LCOV_EXCL_STOP
 
        if (!plog[log_id])
                return DLOG_ERROR_NOT_PERMITTED;