summaryrefslogtreecommitdiffstats
path: root/src/hooks
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2011-04-20 18:23:56 +0200
committerDenys Vlasenko <dvlasenk@redhat.com>2011-04-20 18:23:56 +0200
commit0274b29916883efac50e0961c0a3b49ce8a11f1f (patch)
tree30f88847461ef58b90e7fe42cbdca8740dbc5cc7 /src/hooks
parent3572f658c5829492da1c99eae33b1e9ca9d4518c (diff)
downloadabrt-0274b29916883efac50e0961c0a3b49ce8a11f1f.tar.gz
abrt-0274b29916883efac50e0961c0a3b49ce8a11f1f.tar.xz
abrt-0274b29916883efac50e0961c0a3b49ce8a11f1f.zip
delete ugly parse_conf(), use load_abrt_conf() instead
Therefore moved abrt_conf.* to libreport Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src/hooks')
-rw-r--r--src/hooks/CCpp.conf10
-rw-r--r--src/hooks/Makefile.am5
-rw-r--r--src/hooks/abrt-hook-ccpp.c35
3 files changed, 41 insertions, 9 deletions
diff --git a/src/hooks/CCpp.conf b/src/hooks/CCpp.conf
new file mode 100644
index 00000000..a431c0c3
--- /dev/null
+++ b/src/hooks/CCpp.conf
@@ -0,0 +1,10 @@
+# Configuration file for CCpp hook
+Enabled = yes
+
+# If you also want to dump file named "core"
+# in crashed process' current dir, set to "yes"
+MakeCompatCore = yes
+
+# Do you want a copy of crashed binary be saved?
+# (useful, for example, when _deleted binary_ segfaults)
+SaveBinaryImage = no
diff --git a/src/hooks/Makefile.am b/src/hooks/Makefile.am
index 66951f0f..cae22726 100644
--- a/src/hooks/Makefile.am
+++ b/src/hooks/Makefile.am
@@ -1,3 +1,8 @@
+pluginsconfdir = $(PLUGINS_CONF_DIR)
+
+dist_pluginsconf_DATA = \
+ CCpp.conf
+
libexec_PROGRAMS = abrt-hook-ccpp
# abrt-hook-ccpp
diff --git a/src/hooks/abrt-hook-ccpp.c b/src/hooks/abrt-hook-ccpp.c
index d13851f3..84bbf4fa 100644
--- a/src/hooks/abrt-hook-ccpp.c
+++ b/src/hooks/abrt-hook-ccpp.c
@@ -390,11 +390,27 @@ int main(int argc, char** argv)
char *user_pwd = get_cwd(pid); /* may be NULL on error */
- /* Parse abrt.conf and plugins/CCpp.conf */
- unsigned setting_MaxCrashReportsSize = 0;
- bool setting_MakeCompatCore = false;
- bool setting_SaveBinaryImage = false;
- parse_conf(PLUGINS_CONF_DIR"/CCpp.conf", &setting_MaxCrashReportsSize, &setting_MakeCompatCore, &setting_SaveBinaryImage);
+ /* Parse abrt.conf */
+ load_abrt_conf();
+ free_abrt_conf_data(); /* can do this because we need only g_settings_nMaxCrashReportsSize */
+ /* x1.25: go a bit up, so that usual in-daemon trimming
+ * kicks in first, and we don't "fight" with it:
+ */
+ g_settings_nMaxCrashReportsSize += g_settings_nMaxCrashReportsSize / 4;
+ /* ... and plugins/CCpp.conf */
+ bool setting_MakeCompatCore;
+ bool setting_SaveBinaryImage;
+ {
+ map_string_h *settings = new_map_string();
+ load_conf_file(PLUGINS_CONF_DIR"/CCpp.conf", settings, /*skip key w/o values:*/ false);
+ char *value;
+ value = g_hash_table_lookup(settings, "MakeCompatCore");
+ setting_MakeCompatCore = value && string_to_bool(value);
+ value = g_hash_table_lookup(settings, "SaveBinaryImage");
+ setting_SaveBinaryImage = value && string_to_bool(value);
+ free_map_string(settings);
+ }
+
if (!setting_SaveBinaryImage && src_fd_binary >= 0)
{
close(src_fd_binary);
@@ -441,9 +457,10 @@ int main(int argc, char** argv)
goto create_user_core;
}
- if (setting_MaxCrashReportsSize > 0)
+ if (g_settings_nMaxCrashReportsSize > 0)
{
- check_free_space(setting_MaxCrashReportsSize);
+ g_settings_nMaxCrashReportsSize += g_settings_nMaxCrashReportsSize / 4;
+ check_free_space(g_settings_nMaxCrashReportsSize);
}
char path[PATH_MAX];
@@ -628,9 +645,9 @@ int main(int argc, char** argv)
free(newpath);
/* rhbz#539551: "abrt going crazy when crashing process is respawned" */
- if (setting_MaxCrashReportsSize > 0)
+ if (g_settings_nMaxCrashReportsSize > 0)
{
- trim_debug_dumps(DEBUG_DUMPS_DIR, setting_MaxCrashReportsSize * (double)(1024*1024), path);
+ trim_debug_dumps(DEBUG_DUMPS_DIR, g_settings_nMaxCrashReportsSize * (double)(1024*1024), path);
}
return 0;