Blob Blame History Raw
From 36f80f06119888a2fa5403fdb57102378343bc9b Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <dvlasenk@redhat.com>
Date: Sun, 17 Jul 2011 11:00:44 +0200
Subject: [PATCH] abrtd: pipe post-create output to log. Closes bz#699152

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
(cherry picked from commit 92a230c7f996c67f32106f906dec0dd8e9996aca)

Conflicts:

	src/lib/abrt_conf.c

diff --git a/src/daemon/abrtd.c b/src/daemon/abrtd.c
index 3da3130..d7b3f0e 100644
--- a/src/daemon/abrtd.c
+++ b/src/daemon/abrtd.c
@@ -334,8 +334,11 @@ static int is_crash_a_dup(const char *dump_dir_name, void *param)
 
 static char *do_log(char *log_line, void *param)
 {
-    VERB1 log("%s", log_line);
-    //update_client("%s", log_line);
+    /* We pipe output of post-create events to our log (which usually
+     * includes syslog). Otherwise, errors on post-create result in
+     * "Corrupted or bad dump DIR, deleting" without adequate explanation why.
+     */
+    log("%s", log_line);
     return log_line;
 }
 
diff --git a/src/lib/abrt_conf.c b/src/lib/abrt_conf.c
index 2e13f2d..b978854 100644
--- a/src/lib/abrt_conf.c
+++ b/src/lib/abrt_conf.c
@@ -111,8 +111,13 @@ static void ParseCommon(map_string_h *settings, const char *conf_filename)
     value = g_hash_table_lookup(settings, "MaxCrashReportsSize");
     if (value)
     {
-//FIXME: dont die
-        g_settings_nMaxCrashReportsSize = xatoi_positive(value);
+        char *end;
+        errno = 0;
+        unsigned long ul = strtoul(value, &end, 10);
+        if (errno || end == value || *end != '\0' || ul > INT_MAX)
+            error_msg("Error parsing %s setting: '%s'", "MaxCrashReportsSize", value);
+        else
+            g_settings_nMaxCrashReportsSize = ul;
         g_hash_table_remove(settings, "MaxCrashReportsSize");
     }
 
diff --git a/src/plugins/ccpp_events.conf b/src/plugins/ccpp_events.conf
index 53dc806..c202ba9 100644
--- a/src/plugins/ccpp_events.conf
+++ b/src/plugins/ccpp_events.conf
@@ -9,8 +9,11 @@ EVENT=post-create analyzer=CCpp
             test -r /var/log/messages || exit 0
             executable=`cat executable` &&
             base_executable=${executable##*/} &&
-            grep -F -e "$base_executable" /var/log/messages | tail -999 >var_log_messages &&
-            echo "Element 'var_log_messages' saved"
+            log=`grep -F -e "$base_executable" /var/log/messages | tail -99` &&
+            if test -n "$log"; then
+                prinf "%s\n" "$log" >var_log_messages
+                # echo "Element 'var_log_messages' saved"
+            fi
         )
 
 EVENT=analyze_xsession_errors analyzer=CCpp dso_list~=.*/libX11.*
-- 
1.7.6