]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
log: Fix repetition check
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 11 Apr 2020 05:21:43 +0000 (00:21 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 11 Apr 2020 05:21:43 +0000 (00:21 -0500)
src/lib/server/log.h

index d94c924d0b65d5b3ccbc96661273812eefbfdce3..fed21980f49234f6ee2051291724789ab45d2a8a 100644 (file)
@@ -475,13 +475,15 @@ do {\
                (_entry)->now = time(NULL);\
                if ((_entry)->now != (_entry)->last_complained) {\
                        (_entry)->last_complained = (_entry)->now;\
-                       if ((_entry)->repeated > 0) { \
+                       if (((_entry)->repeated > 0) && (((_entry)->now - (_entry)->last_complained) == 1)) { \
                                _log(_fmt " - repeated %u time(s)", ##__VA_ARGS__, (_entry)->repeated); \
                                (_entry)->repeated = 0; \
                        } else { \
                                _log(_fmt, ##__VA_ARGS__); \
                        }\
-               }\
+               } else { \
+                       (_entry)->repeated++; \
+               } \
        } else (_log(_fmt, ##__VA_ARGS__));\
 } while (0)
 
@@ -510,13 +512,15 @@ do {\
                (_entry)->now = time(NULL);\
                if ((_entry)->now != (_entry)->last_complained) {\
                        (_entry)->last_complained = (_entry)->now;\
-                       if ((_entry)->repeated > 0) { \
+                       if (((_entry)->repeated > 0) && (((_entry)->now - (_entry)->last_complained) == 1)) { \
                                ROPTIONAL(_l_request, _l_global, _fmt " - repeated %u time(s)", ##__VA_ARGS__, (_entry)->repeated); \
                                (_entry)->repeated = 0; \
                        } else { \
                                ROPTIONAL(_l_request, _l_global, _fmt, ##__VA_ARGS__); \
                        }\
-               }\
+               } else { \
+                       (_entry)->repeated++; \
+               } \
        } else { \
                ROPTIONAL(_l_request, _l_global, _fmt, ##__VA_ARGS__);\
        } \