On 07/23/2012 07:34 PM, Denys Vlasenko wrote:
create_dump_dir_from_problem_data() adopts almost all new tricks
from
save_dump_dir_from_problem_data(), but still returns struct dump_dir * -
the caller might want to use dd w/o the need to lock it again.
The libreport patch goes first. abrt one will follow.
--
vda
diff -x '*.po' -d -urpN abrt.2/src/dbus/abrt-dbus.c abrt.3/src/dbus/abrt-dbus.c
--- abrt.2/src/dbus/abrt-dbus.c 2012-07-20 14:02:12.099429162 +0200
+++ abrt.3/src/dbus/abrt-dbus.c 2012-07-23 18:52:00.162672932 +0200
@@ -428,8 +428,8 @@ static void handle_method_call(GDBusConn
free(error);
return;
}
- // else
- response = g_variant_new("(s)", problem_id);
+ /* else */
+ response = g_variant_new("(s)", strrchr(problem_id, '/') + 1);
g_dbus_method_invocation_return_value(invocation, response);
free(problem_id);
diff -x '*.po' -d -urpN abrt.2/src/lib/hooklib.c abrt.3/src/lib/hooklib.c
--- abrt.2/src/lib/hooklib.c 2012-07-20 14:05:07.558077789 +0200
+++ abrt.3/src/lib/hooklib.c 2012-07-23 18:50:40.960685947 +0200
@@ -345,13 +345,20 @@ char *get_backtrace(const char *dump_dir
/** Saves the problem data
* creates the problem_dir in the configured problems directory
- * destroyes
-*/
+ */
char* problem_data_save(problem_data_t *pd)
{
load_abrt_conf();
- char *problem_id = save_dump_dir_from_problem_data(pd, g_settings_dump_location);
- VERB2 log("problem id: '%s'", problem_id);
+ struct dump_dir *dd = create_dump_dir_from_problem_data(pd,
g_settings_dump_location);
+
+ char *problem_id = NULL;
+ if (dd)
+ {
+ problem_id = xstrdup(dd->dd_dirname);
+ dd_close(dd);
+ }
+
+ VERB2 log("problem id: '%s'", problem_id);
return problem_id;
}