Fix endless loop in the logging system when -d=5. Reported by _static_.
[jelmer/ctrlproxy.git] / src / log.c
index 48b4541c5da11a49901147c5fd2c68635d055cd8..b11339ca10540a3516ba8772fd1a96241506093f 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -44,11 +44,13 @@ static void log_entry(enum log_level level, const struct network *n, const struc
        if (level > current_log_level)
                return;
 
-       admin_log(level, n, c, data);
+       if (level < LOG_DATA)
+               admin_log(level, n, c, data);
        
        if (!no_log_timestamp)
                fprintf(flog, "[%s] ", get_date());
        
+       g_assert(strchr(data, '\n') == NULL);
        fprintf(flog, "%s", data);
 
        if (n) {