diff -x '*.po' -d -urpN abrt.2/src/plugins/abrt-dump-oops.c 
abrt.3/src/plugins/abrt-dump-oops.c
--- abrt.2/src/plugins/abrt-dump-oops.c 2013-02-04 12:14:37.000000000 +0100
+++ abrt.3/src/plugins/abrt-dump-oops.c 2013-02-05 13:03:31.193062774 +0100
@@ -19,6 +19,11 @@
 #include <syslog.h>
 #include "libabrt.h"

+/* How many problem dirs to create at most?
+ * Also causes cooldown sleep if exceeded -
+ * useful when called from a log watcher.
+ */
+#define MAX_DUMPED_DD_COUNT  5

 static bool world_readable_dump = false;
 static const char *debug_dumps_dir = ".";
@@ -106,7 +111,7 @@ static char *list_of_tainted_modules(con
 /* returns number of errors */
 static unsigned save_oops_to_dump_dir(GList *oops_list, unsigned oops_cnt)
 {
-    unsigned countdown = 16; /* do not report hundreds of oopses */
+    unsigned countdown = MAX_DUMPED_DD_COUNT + 1; /* do not report hundreds of 
oopses */

     VERB1 log("Saving %u oopses as dump dirs", oops_cnt >= countdown ? 
countdown-1 : oops_cnt);

@@ -333,8 +338,13 @@ int main(int argc, char **argv)
             );
         }
     }
-    //list_free_with_free(oops_list);
+    list_free_with_free(oops_list);
     //oops_list = NULL;

+    if (oops_cnt > MAX_DUMPED_DD_COUNT)
+    {
+        sleep(oops_cnt - MAX_DUMPED_DD_COUNT);
+    }
+
     return errors;
 }
diff -x '*.po' -d -urpN abrt.2/src/plugins/abrt-dump-xorg.c 
abrt.3/src/plugins/abrt-dump-xorg.c
--- abrt.2/src/plugins/abrt-dump-xorg.c 2013-02-04 12:14:37.000000000 +0100
+++ abrt.3/src/plugins/abrt-dump-xorg.c 2013-02-05 12:59:05.625968434 +0100
@@ -35,6 +35,13 @@ enum {
     OPT_m = 1 << 6,
 };

+/* How many problem dirs to create at most?
+ * Also causes cooldown sleep if exceeded -
+ * useful when called from a log watcher.
+ */
+#define MAX_DUMPED_DD_COUNT  5
+
+static unsigned g_bt_count = 0;
 static unsigned g_opts;
 static const char *debug_dumps_dir = ".";
 static unsigned dir_seq_no = 0;
@@ -208,7 +215,8 @@ static void process_xorg_bt(void)
         if (g_opts & OPT_o)
             printf("%s%s%s\n", bt, reason ? reason : "", reason ? "\n" : "");
         if (g_opts & (OPT_d|OPT_D))
-            save_bt_to_dump_dir(bt, exe, reason ? reason : "Xorg server 
crashed");
+            if (g_bt_count <= MAX_DUMPED_DD_COUNT)
+                save_bt_to_dump_dir(bt, exe, reason ? reason : "Xorg server 
crashed");
         free(bt);
     }
     free(reason);
@@ -281,11 +289,18 @@ int main(int argc, char **argv)
         if (strcmp(p, "Backtrace:") == 0)
         {
             free(line);
+            g_bt_count++;
             process_xorg_bt();
             continue;
         }
         free(line);
     }

+    if (opts & (OPT_d|OPT_D))
+    {
+        if (g_bt_count > MAX_DUMPED_DD_COUNT)
+            sleep(g_bt_count - MAX_DUMPED_DD_COUNT);
+    }
+
     return 0;
 }

Reply via email to