summaryrefslogtreecommitdiffstats
path: root/src/lib/create_dump_dir.c
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2010-12-15 18:44:55 +0100
committerDenys Vlasenko <dvlasenk@redhat.com>2010-12-15 18:44:55 +0100
commit6a2b728d7525214402eff838bb37be175ddce6c3 (patch)
tree2a9608f3c9922531a04ced1bbafa6502b10ffe59 /src/lib/create_dump_dir.c
parenta10b0fa6bba8218a82d634100947e084ca8d6a36 (diff)
downloadabrt-6a2b728d7525214402eff838bb37be175ddce6c3.tar.gz
abrt-6a2b728d7525214402eff838bb37be175ddce6c3.tar.xz
abrt-6a2b728d7525214402eff838bb37be175ddce6c3.zip
Rename foo_crash_dump_dir -> foo_dump_dir
To be exact, these three functions are renamed: load_crash_data_from_crash_dump_dir create_crash_dump_dir delete_crash_dump_dir Rationale: data structure is called "struct dump_dir", not "struct crash_dump_dir" Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src/lib/create_dump_dir.c')
-rw-r--r--src/lib/create_dump_dir.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/lib/create_dump_dir.c b/src/lib/create_dump_dir.c
new file mode 100644
index 00000000..8735de27
--- /dev/null
+++ b/src/lib/create_dump_dir.c
@@ -0,0 +1,51 @@
+/*
+ Copyright (C) 2010 ABRT team
+ Copyright (C) 2010 RedHat inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#include "abrtlib.h"
+
+struct dump_dir *create_dump_dir(crash_data_t *crash_data)
+{
+ char *path = xasprintf(LOCALSTATEDIR"/run/abrt/tmp-%lu-%lu", (long)getpid(), (long)time(NULL));
+ struct dump_dir *dd = dd_create(path, getuid());
+ free(path);
+ if (!dd)
+ return NULL;
+
+ GHashTableIter iter;
+ char *name;
+ struct crash_item *value;
+ g_hash_table_iter_init(&iter, crash_data);
+ while (g_hash_table_iter_next(&iter, (void**)&name, (void**)&value))
+ {
+ if (name[0] == '.' || strchr(name, '/'))
+ {
+ error_msg("Crash data field name contains disallowed chars: '%s'", name);
+ goto next;
+ }
+
+//FIXME: what to do with CD_FLAG_BINs??
+ if (value->flags & CD_FLAG_BIN)
+ goto next;
+
+ dd_save_text(dd, name, value->content);
+ next: ;
+ }
+
+ return dd;
+}