From 3ea8cd037dcd5a8439baceadc8df70664eff701c Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 3 Dec 2010 18:56:33 +0100 Subject: preparatory patch: add -v to abrt-cli; remove unused func; make func static Signed-off-by: Denys Vlasenko --- src/cli/CLI.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/cli/CLI.cpp') diff --git a/src/cli/CLI.cpp b/src/cli/CLI.cpp index 44271329..64d629b8 100644 --- a/src/cli/CLI.cpp +++ b/src/cli/CLI.cpp @@ -210,6 +210,7 @@ static const struct option longopts[] = { /* name, has_arg, flag, val */ { "help" , no_argument, NULL, '?' }, + { "verbose" , no_argument, NULL, 'v' }, { "version" , no_argument, NULL, 'V' }, { "list" , no_argument, NULL, 'l' }, { "full" , no_argument, NULL, 'f' }, @@ -243,6 +244,7 @@ static void usage(char *argv0) printf(_("Usage: %s [OPTION]\n\n" "Startup:\n" " -V, --version display the version of %s and exit\n" + " -v, --verbose increase verbosity\n" " -?, --help print this help\n\n" "Actions:\n" " -l, --list print a list of all crashes which are not yet reported\n" @@ -278,8 +280,7 @@ int main(int argc, char** argv) while (1) { /* Do not use colons, arguments are handled after parsing all options. */ - int c = getopt_long_only(argc, argv, "?Vrdlfyib", - longopts, NULL); + int c = getopt_long(argc, argv, "?Vvrdlfyib", longopts, NULL); #define SET_OP(newop) \ if (op != -1 && op != newop) \ @@ -298,6 +299,7 @@ int main(int argc, char** argv) case 'f': full = true; break; case 'y': always = true; break; case 'b': backtrace = true; break; + case 'v': g_verbose++; break; case -1: /* end of options */ break; default: /* some error */ case '?': -- cgit From 47728cc3c70c2b6d3a645e5760b39b20bd946e39 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 6 Dec 2010 16:56:50 +0100 Subject: This patch changes crash data to use C structures. The smallest data element is: struct crash_item { char *content; unsigned flags; }; where content is, eh, content, and flags is a bit flag field. crash_data_t is a map of crash_item's, implemented as a pointer to heap-allocated GHashTable. vector_of_crash_data_t is a vector of crash_data_t's, implemented as a pointer to heap-allocated GPtrArray. Most operations have light wrappers around them to hide the nature of the containers. For example, to free vector_of_crash_data, you need to use free_vector_of_crash_data(ptr) instead of open-coding g_ptr_array_free. The wrapper is thin. The goal is not so much to hide the implementation, but more to make it easier to use the correct function. dbus (un)marshalling functions convert crash_item to three-element array of strings, in order to keep compatibility with abrt-gui (python). This can be changed later to use native representation. crash_data_t and vector_of_crash_data_t are represented in "natural" way, no funny stuff there. Signed-off-by: Denys Vlasenko --- src/cli/CLI.cpp | 91 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 49 insertions(+), 42 deletions(-) (limited to 'src/cli/CLI.cpp') diff --git a/src/cli/CLI.cpp b/src/cli/CLI.cpp index 64d629b8..fd8ec4f0 100644 --- a/src/cli/CLI.cpp +++ b/src/cli/CLI.cpp @@ -38,10 +38,10 @@ static char *localize_crash_time(const char *timestr) } /** Prints basic information about a crash to stdout. */ -static void print_crash(const map_crash_data_t &crash) +static void print_crash(crash_data_t *crash_data) { /* Create a localized string from crash time. */ - const char *timestr = get_crash_data_item_content(crash, FILENAME_TIME).c_str(); + const char *timestr = get_crash_item_content_or_die(crash_data, FILENAME_TIME); const char *timeloc = localize_crash_time(timestr); printf(_("\tCrash dump : %s\n" @@ -50,17 +50,18 @@ static void print_crash(const map_crash_data_t &crash) "\tExecutable : %s\n" "\tCrash Time : %s\n" "\tCrash Count: %s\n"), - get_crash_data_item_content(crash, CD_DUMPDIR).c_str(), - get_crash_data_item_content(crash, FILENAME_UID).c_str(), - get_crash_data_item_content(crash, FILENAME_PACKAGE).c_str(), - get_crash_data_item_content(crash, FILENAME_EXECUTABLE).c_str(), + get_crash_item_content_or_NULL(crash_data, CD_DUMPDIR), + get_crash_item_content_or_NULL(crash_data, FILENAME_UID), + get_crash_item_content_or_NULL(crash_data, FILENAME_PACKAGE), + get_crash_item_content_or_NULL(crash_data, FILENAME_EXECUTABLE), timeloc, - get_crash_data_item_content(crash, FILENAME_COUNT).c_str()); + get_crash_item_content_or_NULL(crash_data, FILENAME_COUNT) + ); free((void *)timeloc); /* Print the hostname if it's available. */ - const char *hostname = get_crash_data_item_content_or_NULL(crash, FILENAME_HOSTNAME); + const char *hostname = get_crash_item_content_or_NULL(crash_data, FILENAME_HOSTNAME); if (hostname) printf(_("\tHostname : %s\n"), hostname); } @@ -70,14 +71,14 @@ static void print_crash(const map_crash_data_t &crash) * @param include_reported * Do not skip entries marked as already reported. */ -static void print_crash_list(const vector_map_crash_data_t& crash_list, bool include_reported) +static void print_crash_list(vector_of_crash_data_t *crash_list, bool include_reported) { - for (unsigned i = 0; i < crash_list.size(); ++i) + for (unsigned i = 0; i < crash_list->len; ++i) { - const map_crash_data_t& crash = crash_list[i]; + crash_data_t *crash = get_crash_data(crash_list, i); if (!include_reported) { - const char *msg = get_crash_data_item_content_or_NULL(crash, FILENAME_MESSAGE); + const char *msg = get_crash_item_content_or_NULL(crash, FILENAME_MESSAGE); if (!msg || !msg[0]) continue; } @@ -90,9 +91,9 @@ static void print_crash_list(const vector_map_crash_data_t& crash_list, bool inc /** * Prints full information about a crash */ -static void print_crash_info(const map_crash_data_t& crash, bool show_backtrace) +static void print_crash_info(crash_data_t *crash_data, bool show_backtrace) { - const char *timestr = get_crash_data_item_content(crash, FILENAME_TIME).c_str(); + const char *timestr = get_crash_item_content_or_die(crash_data, FILENAME_TIME); const char *timeloc = localize_crash_time(timestr); printf(_("Dump directory: %s\n" @@ -104,50 +105,51 @@ static void print_crash_info(const map_crash_data_t& crash, bool show_backtrace) "Executable: %s\n" "System: %s, kernel %s\n" "Reason: %s\n"), - get_crash_data_item_content(crash, CD_DUMPDIR).c_str(), + get_crash_item_content_or_die(crash_data, CD_DUMPDIR), timeloc, - get_crash_data_item_content(crash, FILENAME_ANALYZER).c_str(), - get_crash_data_item_content(crash, FILENAME_COMPONENT).c_str(), - get_crash_data_item_content(crash, FILENAME_PACKAGE).c_str(), - get_crash_data_item_content(crash, FILENAME_CMDLINE).c_str(), - get_crash_data_item_content(crash, FILENAME_EXECUTABLE).c_str(), - get_crash_data_item_content(crash, FILENAME_RELEASE).c_str(), - get_crash_data_item_content(crash, FILENAME_KERNEL).c_str(), - get_crash_data_item_content(crash, FILENAME_REASON).c_str()); + get_crash_item_content_or_die(crash_data, FILENAME_ANALYZER), + get_crash_item_content_or_die(crash_data, FILENAME_COMPONENT), + get_crash_item_content_or_die(crash_data, FILENAME_PACKAGE), + get_crash_item_content_or_die(crash_data, FILENAME_CMDLINE), + get_crash_item_content_or_die(crash_data, FILENAME_EXECUTABLE), + get_crash_item_content_or_die(crash_data, FILENAME_RELEASE), + get_crash_item_content_or_die(crash_data, FILENAME_KERNEL), + get_crash_item_content_or_die(crash_data, FILENAME_REASON) + ); free((void *)timeloc); /* Print optional fields only if they are available */ /* Coredump is not present in kerneloopses and Python exceptions. */ - const char *coredump = get_crash_data_item_content_or_NULL(crash, FILENAME_COREDUMP); + const char *coredump = get_crash_item_content_or_NULL(crash_data, FILENAME_COREDUMP); if (coredump) printf(_("Coredump file: %s\n"), coredump); - const char *rating = get_crash_data_item_content_or_NULL(crash, FILENAME_RATING); + const char *rating = get_crash_item_content_or_NULL(crash_data, FILENAME_RATING); if (rating) printf(_("Rating: %s\n"), rating); /* Crash function is not present in kerneloopses, and before the full report is created.*/ - const char *crash_function = get_crash_data_item_content_or_NULL(crash, FILENAME_CRASH_FUNCTION); + const char *crash_function = get_crash_item_content_or_NULL(crash_data, FILENAME_CRASH_FUNCTION); if (crash_function) printf(_("Crash function: %s\n"), crash_function); - const char *hostname = get_crash_data_item_content_or_NULL(crash, FILENAME_HOSTNAME); + const char *hostname = get_crash_item_content_or_NULL(crash_data, FILENAME_HOSTNAME); if (hostname) printf(_("Hostname: %s\n"), hostname); - const char *reproduce = get_crash_data_item_content_or_NULL(crash, FILENAME_REPRODUCE); + const char *reproduce = get_crash_item_content_or_NULL(crash_data, FILENAME_REPRODUCE); if (reproduce) printf(_("\nHow to reproduce:\n%s\n"), reproduce); - const char *comment = get_crash_data_item_content_or_NULL(crash, FILENAME_COMMENT); + const char *comment = get_crash_item_content_or_NULL(crash_data, FILENAME_COMMENT); if (comment) printf(_("\nComment:\n%s\n"), comment); if (show_backtrace) { - const char *backtrace = get_crash_data_item_content_or_NULL(crash, FILENAME_BACKTRACE); + const char *backtrace = get_crash_item_content_or_NULL(crash_data, FILENAME_BACKTRACE); if (backtrace) printf(_("\nBacktrace:\n%s\n"), backtrace); } @@ -159,15 +161,17 @@ static void print_crash_info(const map_crash_data_t& crash, bool show_backtrace) */ static char *guess_crash_id(const char *str) { - vector_map_crash_data_t ci = call_GetCrashInfos(); - unsigned num_crashinfos = ci.size(); + vector_of_crash_data_t *ci = call_GetCrashInfos(); + unsigned num_crashinfos = ci->len; if (str[0] == '@') /* "--report @N" syntax */ { unsigned position = xatoi_u(str + 1); if (position >= num_crashinfos) error_msg_and_die("There are only %u crash infos", num_crashinfos); - map_crash_data_t& info = ci[position]; - return xstrdup(get_crash_data_item_content(info, CD_DUMPDIR).c_str()); + crash_data_t *info = get_crash_data(ci, position); + char *res = xstrdup(get_crash_item_content_or_die(info, CD_DUMPDIR)); + free_vector_of_crash_data(ci); + return res; } unsigned len = strlen(str); @@ -175,8 +179,8 @@ static char *guess_crash_id(const char *str) char *result = NULL; for (ii = 0; ii < num_crashinfos; ii++) { - map_crash_data_t& info = ci[ii]; - const char *this_dir = get_crash_data_item_content(info, CD_DUMPDIR).c_str(); + crash_data_t *info = get_crash_data(ci, ii); + const char *this_dir = get_crash_item_content_or_die(info, CD_DUMPDIR); if (strncmp(str, this_dir, len) == 0) { if (result) @@ -184,6 +188,7 @@ static char *guess_crash_id(const char *str) result = xstrdup(this_dir); } } + free_vector_of_crash_data(ci); if (!result) error_msg_and_die("Crash dump directory '%s' not found", str); return result; @@ -353,8 +358,9 @@ int main(int argc, char** argv) { case OPT_GET_LIST: { - vector_map_crash_data_t ci = call_GetCrashInfos(); + vector_of_crash_data_t *ci = call_GetCrashInfos(); print_crash_list(ci, full); + free_vector_of_crash_data(ci); break; } case OPT_REPORT: @@ -403,12 +409,12 @@ int main(int argc, char** argv) int old_logmode = logmode; logmode = 0; - map_crash_data_t crashData = call_CreateReport(crash_id); - if (crashData.empty()) /* no such crash_id */ + crash_data_t *crash_data = call_CreateReport(crash_id); + if (!crash_data) /* no such crash_id */ { crash_id = guess_crash_id(crash_id); - crashData = call_CreateReport(crash_id); - if (crashData.empty()) + crash_data = call_CreateReport(crash_id); + if (!crash_data) { error_msg("Crash '%s' not found", crash_id); free((void *)crash_id); @@ -420,7 +426,8 @@ int main(int argc, char** argv) logmode = old_logmode; - print_crash_info(crashData, backtrace); + print_crash_info(crash_data, backtrace); + free_crash_data(crash_data); break; } -- cgit From 816f3e001271ed8ab7fdadb6d90aeb2c61362dac Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 8 Dec 2010 14:51:47 +0100 Subject: removal of C++isms from libabrt, part 1 This patch converts libabrt usage of C++ map to a glib-based container, GHashTable. It is typedef-ed to map_string_h. We can't typedef it to map_string_t, since other parts of ABRT (daemon, cli) still use that name for C++ container. Also, exceptions are removed everywhere. Signed-off-by: Denys Vlasenko --- src/cli/CLI.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/cli/CLI.cpp') diff --git a/src/cli/CLI.cpp b/src/cli/CLI.cpp index fd8ec4f0..cdce6b8a 100644 --- a/src/cli/CLI.cpp +++ b/src/cli/CLI.cpp @@ -19,7 +19,6 @@ # include #endif #include -#include "abrt_exception.h" #include "abrtlib.h" #include "abrt_dbus.h" #include "dbus_common.h" -- cgit From dc3c5b79ba1ee6fd7a98842fde43d072e004f93b Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 8 Dec 2010 16:07:31 +0100 Subject: add abrt_ prefixes to abrt-internal functions in libabrt.so Signed-off-by: Denys Vlasenko --- src/cli/CLI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cli/CLI.cpp') diff --git a/src/cli/CLI.cpp b/src/cli/CLI.cpp index cdce6b8a..aeb1d461 100644 --- a/src/cli/CLI.cpp +++ b/src/cli/CLI.cpp @@ -164,7 +164,7 @@ static char *guess_crash_id(const char *str) unsigned num_crashinfos = ci->len; if (str[0] == '@') /* "--report @N" syntax */ { - unsigned position = xatoi_u(str + 1); + unsigned position = xatoi_positive(str + 1); if (position >= num_crashinfos) error_msg_and_die("There are only %u crash infos", num_crashinfos); crash_data_t *info = get_crash_data(ci, position); -- cgit From 5c71e00f814f679bd6ea652eda8552f746b5f725 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 27 Jan 2011 15:59:28 +0100 Subject: preparatory changes for abrt-cli local processing change Signed-off-by: Denys Vlasenko --- src/cli/CLI.cpp | 144 +++++++++++++------------------------------------------- 1 file changed, 33 insertions(+), 111 deletions(-) (limited to 'src/cli/CLI.cpp') diff --git a/src/cli/CLI.cpp b/src/cli/CLI.cpp index aeb1d461..5f95c4f7 100644 --- a/src/cli/CLI.cpp +++ b/src/cli/CLI.cpp @@ -30,10 +30,10 @@ static char *localize_crash_time(const char *timestr) { long time = xatou(timestr); char timeloc[256]; - int success = strftime(timeloc, 128, "%c", localtime(&time)); + int success = strftime(timeloc, sizeof(timeloc), "%c", localtime(&time)); if (!success) - error_msg_and_die("Error while converting time to string"); - return xasprintf("%s", timeloc); + error_msg_and_die("Error while converting time '%s' to string", timestr); + return xstrdup(timeloc); } /** Prints basic information about a crash to stdout. */ @@ -41,7 +41,7 @@ static void print_crash(crash_data_t *crash_data) { /* Create a localized string from crash time. */ const char *timestr = get_crash_item_content_or_die(crash_data, FILENAME_TIME); - const char *timeloc = localize_crash_time(timestr); + char *timeloc = localize_crash_time(timestr); printf(_("\tCrash dump : %s\n" "\tUID : %s\n" @@ -57,7 +57,7 @@ static void print_crash(crash_data_t *crash_data) get_crash_item_content_or_NULL(crash_data, FILENAME_COUNT) ); - free((void *)timeloc); + free(timeloc); /* Print the hostname if it's available. */ const char *hostname = get_crash_item_content_or_NULL(crash_data, FILENAME_HOSTNAME); @@ -93,7 +93,7 @@ static void print_crash_list(vector_of_crash_data_t *crash_list, bool include_re static void print_crash_info(crash_data_t *crash_data, bool show_backtrace) { const char *timestr = get_crash_item_content_or_die(crash_data, FILENAME_TIME); - const char *timeloc = localize_crash_time(timestr); + char *timeloc = localize_crash_time(timestr); printf(_("Dump directory: %s\n" "Last crash: %s\n" @@ -116,7 +116,7 @@ static void print_crash_info(crash_data_t *crash_data, bool show_backtrace) get_crash_item_content_or_die(crash_data, FILENAME_REASON) ); - free((void *)timeloc); + free(timeloc); /* Print optional fields only if they are available */ @@ -154,45 +154,6 @@ static void print_crash_info(crash_data_t *crash_data, bool show_backtrace) } } -/** - * Converts crash reference from user's input to crash dump dir name. - * The returned string must be released by caller. - */ -static char *guess_crash_id(const char *str) -{ - vector_of_crash_data_t *ci = call_GetCrashInfos(); - unsigned num_crashinfos = ci->len; - if (str[0] == '@') /* "--report @N" syntax */ - { - unsigned position = xatoi_positive(str + 1); - if (position >= num_crashinfos) - error_msg_and_die("There are only %u crash infos", num_crashinfos); - crash_data_t *info = get_crash_data(ci, position); - char *res = xstrdup(get_crash_item_content_or_die(info, CD_DUMPDIR)); - free_vector_of_crash_data(ci); - return res; - } - - unsigned len = strlen(str); - unsigned ii; - char *result = NULL; - for (ii = 0; ii < num_crashinfos; ii++) - { - crash_data_t *info = get_crash_data(ci, ii); - const char *this_dir = get_crash_item_content_or_die(info, CD_DUMPDIR); - if (strncmp(str, this_dir, len) == 0) - { - if (result) - error_msg_and_die("Crash prefix '%s' is not unique", str); - result = xstrdup(this_dir); - } - } - free_vector_of_crash_data(ci); - if (!result) - error_msg_and_die("Crash dump directory '%s' not found", str); - return result; -} - /* Program options */ enum { @@ -247,9 +208,8 @@ static void usage(char *argv0) /* Message has embedded tabs. */ printf(_("Usage: %s [OPTION]\n\n" "Startup:\n" - " -V, --version display the version of %s and exit\n" + " -V, --version display the version and exit\n" " -v, --verbose increase verbosity\n" - " -?, --help print this help\n\n" "Actions:\n" " -l, --list print a list of all crashes which are not yet reported\n" " -f, --full print a list of all crashes, including the already reported ones\n" @@ -262,14 +222,14 @@ static void usage(char *argv0) " a name of dump directory, or\n" " @N - N'th crash (as displayed by --list --full) will be acted upon\n" ), - name, name); + name); exit(1); } int main(int argc, char** argv) { - const char* crash_id = NULL; + char *dump_dir_name = NULL; int op = -1; bool full = false; bool always = false; @@ -286,16 +246,16 @@ int main(int argc, char** argv) /* Do not use colons, arguments are handled after parsing all options. */ int c = getopt_long(argc, argv, "?Vvrdlfyib", longopts, NULL); -#define SET_OP(newop) \ - if (op != -1 && op != newop) \ - { \ - error_msg(_("You must specify exactly one operation")); \ - return 1; \ - } \ - op = newop; +#define SET_OP(newop) \ + do { \ + if (op != -1 && op != newop) \ + error_msg_and_die(_("You must specify exactly one operation")); \ + op = newop; \ + } while (0) switch (c) { + case -1: goto end_of_arg_parsing; case 'r': SET_OP(OPT_REPORT); break; case 'd': SET_OP(OPT_DELETE); break; case 'l': SET_OP(OPT_GET_LIST); break; @@ -304,22 +264,20 @@ int main(int argc, char** argv) case 'y': always = true; break; case 'b': backtrace = true; break; case 'v': g_verbose++; break; - case -1: /* end of options */ break; - default: /* some error */ - case '?': - usage(argv[0]); /* exits app */ case 'V': printf("%s "VERSION"\n", progname(argv[0])); return 0; + case '?': + default: /* some error */ + usage(argv[0]); /* exits app */ } #undef SET_OP - if (c == -1) - break; } + end_of_arg_parsing: ; /* Handle option arguments. */ - int arg_count = argc - optind; - switch (arg_count) + argc -= optind; + switch (argc) { case 0: if (op == OPT_REPORT || op == OPT_DELETE || op == OPT_INFO) @@ -328,7 +286,7 @@ int main(int argc, char** argv) case 1: if (op != OPT_REPORT && op != OPT_DELETE && op != OPT_INFO) usage(argv[0]); - crash_id = argv[optind]; + dump_dir_name = argv[optind]; break; default: usage(argv[0]); @@ -364,43 +322,18 @@ int main(int argc, char** argv) } case OPT_REPORT: { - int flags = CLI_REPORT_SILENT_IF_NOT_FOUND; - if (always) - flags |= CLI_REPORT_BATCH; - exitcode = report(crash_id, flags); - if (exitcode == -1) /* no such crash_id */ - { - crash_id = guess_crash_id(crash_id); - exitcode = report(crash_id, always ? CLI_REPORT_BATCH : 0); - if (exitcode == -1) - { - error_msg("Crash '%s' not found", crash_id); - free((void *)crash_id); - xfunc_die(); - } - - free((void *)crash_id); - } + exitcode = report(dump_dir_name, (always ? CLI_REPORT_BATCH : 0)); + if (exitcode == -1) + error_msg_and_die("Crash '%s' not found", dump_dir_name); break; } case OPT_DELETE: { - exitcode = call_DeleteDebugDump(crash_id); + exitcode = call_DeleteDebugDump(dump_dir_name); if (exitcode == ENOENT) - { - crash_id = guess_crash_id(crash_id); - exitcode = call_DeleteDebugDump(crash_id); - if (exitcode == ENOENT) - { - error_msg("Crash '%s' not found", crash_id); - free((void *)crash_id); - xfunc_die(); - } - - free((void *)crash_id); - } + error_msg_and_die("Crash '%s' not found", dump_dir_name); if (exitcode != 0) - error_msg_and_die("Can't delete debug dump '%s'", crash_id); + error_msg_and_die("Can't delete debug dump '%s'", dump_dir_name); break; } case OPT_INFO: @@ -408,20 +341,9 @@ int main(int argc, char** argv) int old_logmode = logmode; logmode = 0; - crash_data_t *crash_data = call_CreateReport(crash_id); - if (!crash_data) /* no such crash_id */ - { - crash_id = guess_crash_id(crash_id); - crash_data = call_CreateReport(crash_id); - if (!crash_data) - { - error_msg("Crash '%s' not found", crash_id); - free((void *)crash_id); - xfunc_die(); - } - - free((void *)crash_id); - } + crash_data_t *crash_data = call_CreateReport(dump_dir_name); + if (!crash_data) + error_msg_and_die("Crash '%s' not found", dump_dir_name); logmode = old_logmode; -- cgit From 876664f002c5f90e5722602956a6d60591619680 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 1 Feb 2011 15:57:39 +0100 Subject: abrt-cli: converted to process events locally Only -d DIR operation still goes through the daemon. Signed-off-by: Denys Vlasenko --- src/cli/CLI.cpp | 134 ++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 101 insertions(+), 33 deletions(-) (limited to 'src/cli/CLI.cpp') diff --git a/src/cli/CLI.cpp b/src/cli/CLI.cpp index 5f95c4f7..9af1cbc7 100644 --- a/src/cli/CLI.cpp +++ b/src/cli/CLI.cpp @@ -36,6 +36,51 @@ static char *localize_crash_time(const char *timestr) return xstrdup(timeloc); } +static crash_data_t *FillCrashInfo(const char *dump_dir_name) +{ + struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0); + if (!dd) + return NULL; + + crash_data_t *crash_data = create_crash_data_from_dump_dir(dd); +// char *events = list_possible_events(dd, NULL, ""); + dd_close(dd); +// add_to_crash_data_ext(crash_data, CD_EVENTS, events, CD_FLAG_SYS + CD_FLAG_ISNOTEDITABLE); +// free(events); + add_to_crash_data_ext(crash_data, CD_DUMPDIR, dump_dir_name, CD_FLAG_SYS + CD_FLAG_ISNOTEDITABLE); + + return crash_data; +} + +static void GetCrashInfos(vector_of_crash_data_t *retval, const char *dir_name) +{ + VERB1 log("Loading dumps from '%s'", dir_name); + + DIR *dir = opendir(dir_name); + if (dir != NULL) + { + struct dirent *dent; + while ((dent = readdir(dir)) != NULL) + { + if (dot_or_dotdot(dent->d_name)) + continue; /* skip "." and ".." */ + + char *dump_dir_name = concat_path_file(dir_name, dent->d_name); + + struct stat statbuf; + if (stat(dump_dir_name, &statbuf) == 0 + && S_ISDIR(statbuf.st_mode) + ) { + crash_data_t *crash_data = FillCrashInfo(dump_dir_name); + if (crash_data) + g_ptr_array_add(retval, crash_data); + } + free(dump_dir_name); + } + closedir(dir); + } +} + /** Prints basic information about a crash to stdout. */ static void print_crash(crash_data_t *crash_data) { @@ -200,35 +245,41 @@ static const char *progname(const char *argv0) * Prints abrt-cli version and some help text. * Then exits the program with return value 1. */ -static void usage(char *argv0) +static void print_usage_and_die(char *argv0) { const char *name = progname(argv0); printf("%s "VERSION"\n\n", name); /* Message has embedded tabs. */ - printf(_("Usage: %s [OPTION]\n\n" - "Startup:\n" - " -V, --version display the version and exit\n" - " -v, --verbose increase verbosity\n" - "Actions:\n" - " -l, --list print a list of all crashes which are not yet reported\n" - " -f, --full print a list of all crashes, including the already reported ones\n" - " -r, --report CRASH_ID create and send a report\n" - " -y, --always create and send a report without asking\n" - " -d, --delete CRASH_ID remove a crash\n" - " -i, --info CRASH_ID print detailed information about a crash\n" - " -b, --backtrace print detailed information about a crash including backtrace\n" - "CRASH_ID can be:\n" - " a name of dump directory, or\n" - " @N - N'th crash (as displayed by --list --full) will be acted upon\n" + printf(_( + "Usage: %s -l[f] [-D BASE_DIR]...]\n" + " or: %s -r[y] CRASH_DIR\n" + " or: %s -i[b] CRASH_DIR\n" + " or: %s -d CRASH_DIR\n" + "\n" + " -l, --list List not yet reported crashes\n" + " -f, --full List all crashes\n" + " -D BASE_DIR Directory to list crashes from\n" + " (default: -D $HOME/abrt/spool -D %s)\n" + "\n" + " -r, --report Send a report about CRASH_DIR\n" + " -y, --always ...without editing and asking\n" + " -i, --info Print detailed information about CRASH_DIR\n" + " -b, --backtrace ...including backtrace\n" + " -d, --delete Remove CRASH_DIR\n" + "\n" + " -V, --version Display version and exit\n" + " -v, --verbose Be verbose\n" ), - name); - + name, name, name, name, + DEBUG_DUMPS_DIR + ); exit(1); } int main(int argc, char** argv) { + GList *D_list = NULL; char *dump_dir_name = NULL; int op = -1; bool full = false; @@ -264,12 +315,15 @@ int main(int argc, char** argv) case 'y': always = true; break; case 'b': backtrace = true; break; case 'v': g_verbose++; break; + case 'D': + D_list = g_list_append(D_list, optarg); + break; case 'V': printf("%s "VERSION"\n", progname(argv[0])); return 0; case '?': default: /* some error */ - usage(argv[0]); /* exits app */ + print_usage_and_die(argv[0]); /* exits app */ } #undef SET_OP } @@ -281,15 +335,15 @@ int main(int argc, char** argv) { case 0: if (op == OPT_REPORT || op == OPT_DELETE || op == OPT_INFO) - usage(argv[0]); + print_usage_and_die(argv[0]); break; case 1: if (op != OPT_REPORT && op != OPT_DELETE && op != OPT_INFO) - usage(argv[0]); + print_usage_and_die(argv[0]); dump_dir_name = argv[optind]; break; default: - usage(argv[0]); + print_usage_and_die(argv[0]); } /* Check if we have an operation. @@ -300,8 +354,7 @@ int main(int argc, char** argv) (backtrace && op != OPT_INFO) || op == -1) { - usage(argv[0]); - return 1; + print_usage_and_die(argv[0]); } DBusError err; @@ -315,7 +368,20 @@ int main(int argc, char** argv) { case OPT_GET_LIST: { - vector_of_crash_data_t *ci = call_GetCrashInfos(); + if (!D_list) + { + char *home = getenv("HOME"); + if (home) + D_list = g_list_append(D_list, concat_path_file(home, "abrt/spool")); + D_list = g_list_append(D_list, (void*)DEBUG_DUMPS_DIR); + } + vector_of_crash_data_t *ci = new_vector_of_crash_data(); + while (D_list) + { + char *dir = (char *)D_list->data; + GetCrashInfos(ci, dir); + D_list = g_list_remove(D_list, dir); + } print_crash_list(ci, full); free_vector_of_crash_data(ci); break; @@ -338,14 +404,16 @@ int main(int argc, char** argv) } case OPT_INFO: { - int old_logmode = logmode; - logmode = 0; - - crash_data_t *crash_data = call_CreateReport(dump_dir_name); - if (!crash_data) - error_msg_and_die("Crash '%s' not found", dump_dir_name); - - logmode = old_logmode; + if (run_analyze_event(dump_dir_name) != 0) + return 1; + + /* Load crash_data from (possibly updated by analyze) dump dir */ + struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0); + if (!dd) + return -1; + crash_data_t *crash_data = create_crash_data_from_dump_dir(dd); + dd_close(dd); + add_to_crash_data_ext(crash_data, CD_DUMPDIR, dump_dir_name, CD_FLAG_SYS + CD_FLAG_ISNOTEDITABLE); print_crash_info(crash_data, backtrace); free_crash_data(crash_data); -- cgit From 55ae0eaea8684aa78089bbd0c2116e0c8cb25585 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 1 Feb 2011 16:04:30 +0100 Subject: abrt-cli -r DIR: copy non-writable DIR into $HOME/abrt/spool Signed-off-by: Denys Vlasenko --- src/cli/CLI.cpp | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 66 insertions(+), 8 deletions(-) (limited to 'src/cli/CLI.cpp') diff --git a/src/cli/CLI.cpp b/src/cli/CLI.cpp index 9af1cbc7..af85a9e9 100644 --- a/src/cli/CLI.cpp +++ b/src/cli/CLI.cpp @@ -38,7 +38,7 @@ static char *localize_crash_time(const char *timestr) static crash_data_t *FillCrashInfo(const char *dump_dir_name) { - struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0); + struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ DD_OPEN_READONLY); if (!dd) return NULL; @@ -199,6 +199,46 @@ static void print_crash_info(crash_data_t *crash_data, bool show_backtrace) } } +static struct dump_dir *steal_directory(const char *base_dir, const char *dump_dir_name) +{ + const char *base_name = strrchr(dump_dir_name, '/'); + if (base_name) + base_name++; + else + base_name = dump_dir_name; + + struct dump_dir *dd_dst; + unsigned count = 100; + char *dst_dir_name = concat_path_file(base_dir, base_name); + while (1) + { + dd_dst = dd_create(dst_dir_name, (uid_t)-1); + free(dst_dir_name); + if (dd_dst) + break; + if (--count == 0) + { + error_msg("Can't create new dump dir in '%s'", base_dir); + goto ret; + } + struct timeval tv; + gettimeofday(&tv, NULL); + dst_dir_name = xasprintf("%s/%s.%u", base_dir, base_name, (int)tv.tv_usec); + } + + log("Creating copy in '%s'", dd_dst->dd_dir); + if (copy_file_recursive(dump_dir_name, dd_dst->dd_dir) < 0) + { + /* error. copy_file_recursive already emitted error message */ + dd_close(dd_dst); + xfunc_die(); + } + + ret: + return dd_dst; +} + + /* Program options */ enum { @@ -329,6 +369,14 @@ int main(int argc, char** argv) } end_of_arg_parsing: ; + if (!D_list) + { + char *home = getenv("HOME"); + if (home) + D_list = g_list_append(D_list, concat_path_file(home, "abrt/spool")); + D_list = g_list_append(D_list, (void*)DEBUG_DUMPS_DIR); + } + /* Handle option arguments. */ argc -= optind; switch (argc) @@ -368,13 +416,6 @@ int main(int argc, char** argv) { case OPT_GET_LIST: { - if (!D_list) - { - char *home = getenv("HOME"); - if (home) - D_list = g_list_append(D_list, concat_path_file(home, "abrt/spool")); - D_list = g_list_append(D_list, (void*)DEBUG_DUMPS_DIR); - } vector_of_crash_data_t *ci = new_vector_of_crash_data(); while (D_list) { @@ -388,6 +429,23 @@ int main(int argc, char** argv) } case OPT_REPORT: { + struct dump_dir *dd = dd_opendir(dump_dir_name, DD_OPEN_READONLY); + if (!dd) + break; + int readonly = !dd->locked; + dd_close(dd); + if (readonly) + { + log("'%s' is not writable", dump_dir_name); + /* D_list can't be NULL here */ + struct dump_dir *dd_copy = steal_directory((char *)D_list->data, dump_dir_name); + if (dd_copy) + { + dump_dir_name = xstrdup(dd_copy->dd_dir); + dd_close(dd_copy); + } + } + exitcode = report(dump_dir_name, (always ? CLI_REPORT_BATCH : 0)); if (exitcode == -1) error_msg_and_die("Crash '%s' not found", dump_dir_name); -- cgit From aa588deee9b47db4ddc1070581f5c3690139095d Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 3 Feb 2011 14:32:33 +0100 Subject: cli: change user's abrt dir from $HOME/abrt to $HOME/.abrt Signed-off-by: Denys Vlasenko --- src/cli/CLI.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/cli/CLI.cpp') diff --git a/src/cli/CLI.cpp b/src/cli/CLI.cpp index af85a9e9..2ac63422 100644 --- a/src/cli/CLI.cpp +++ b/src/cli/CLI.cpp @@ -300,7 +300,7 @@ static void print_usage_and_die(char *argv0) " -l, --list List not yet reported crashes\n" " -f, --full List all crashes\n" " -D BASE_DIR Directory to list crashes from\n" - " (default: -D $HOME/abrt/spool -D %s)\n" + " (default: -D $HOME/.abrt/spool -D %s)\n" "\n" " -r, --report Send a report about CRASH_DIR\n" " -y, --always ...without editing and asking\n" @@ -373,7 +373,7 @@ int main(int argc, char** argv) { char *home = getenv("HOME"); if (home) - D_list = g_list_append(D_list, concat_path_file(home, "abrt/spool")); + D_list = g_list_append(D_list, concat_path_file(home, ".abrt/spool")); D_list = g_list_append(D_list, (void*)DEBUG_DUMPS_DIR); } -- cgit From 6eb815b57676f75ed5205590409f384244b2580a Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 7 Feb 2011 15:35:35 +0100 Subject: abrt-cli: delete half-copied dir on dir copy error Also, make -d DIR to try deletion itself before resorting to abrtd Signed-off-by: Denys Vlasenko --- src/cli/CLI.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/cli/CLI.cpp') diff --git a/src/cli/CLI.cpp b/src/cli/CLI.cpp index 2ac63422..59c145f5 100644 --- a/src/cli/CLI.cpp +++ b/src/cli/CLI.cpp @@ -230,7 +230,8 @@ static struct dump_dir *steal_directory(const char *base_dir, const char *dump_d if (copy_file_recursive(dump_dir_name, dd_dst->dd_dir) < 0) { /* error. copy_file_recursive already emitted error message */ - dd_close(dd_dst); + /* Don't leave half-copied dir lying around */ + dd_delete(dd_dst); xfunc_die(); } @@ -453,6 +454,18 @@ int main(int argc, char** argv) } case OPT_DELETE: { + /* Try to delete it ourselves */ + struct dump_dir *dd = dd_opendir(dump_dir_name, DD_OPEN_READONLY); + if (dd) + { + if (dd->locked) /* it is not readonly */ + { + dd_delete(dd); + break; + } + dd_close(dd); + } + /* Ask abrtd to do it for us */ exitcode = call_DeleteDebugDump(dump_dir_name); if (exitcode == ENOENT) error_msg_and_die("Crash '%s' not found", dump_dir_name); -- cgit From 0df5e344cdf94ffb1d3ef471cc7be5d6a9699732 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 7 Feb 2011 15:37:47 +0100 Subject: abrt-cli: suppress errors when we try to read dump dirs which aren't ours $ abrt-cli -lf Can't create lock file '/var/spool/abrt/ccpp-1296609283-15129/.lock': Permission denied Can't access '/var/spool/abrt/ccpp-1296609283-15129': Permission denied Can't create lock file '/var/spool/abrt/ccpp-1294848465-26639/.lock': Permission denied Can't access '/var/spool/abrt/ccpp-1294848465-26639': Permission denied Can't create lock file '/var/spool/abrt/ccpp-1294848466-26657/.lock': Permission denied Can't access '/var/spool/abrt/ccpp-1294848466-26657': Permission denied ^^^^^^^^^^^^^^^^^^^^ these messages 0. Crash dump : /home/test/.abrt/spool/ccpp-1296609283-15129.868047 UID : 0 Package : coreutils-8.4-10.fc13 Executable : /bin/sleep Crash Time : Wed 02 Feb 2011 02:14:43 AM CET Crash Count: 1 Hostname : dhcp-25-227.brq.redhat.com 1. Crash dump : /home/test/.abrt/spool/ccpp-1296609283-15129 UID : 0 Package : coreutils-8.4-10.fc13 Executable : /bin/sleep Crash Time : Wed 02 Feb 2011 02:14:43 AM CET Crash Count: 1 Hostname : dhcp-25-227.brq.redhat.com Signed-off-by: Denys Vlasenko --- src/cli/CLI.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/cli/CLI.cpp') diff --git a/src/cli/CLI.cpp b/src/cli/CLI.cpp index 59c145f5..527d5de9 100644 --- a/src/cli/CLI.cpp +++ b/src/cli/CLI.cpp @@ -38,7 +38,11 @@ static char *localize_crash_time(const char *timestr) static crash_data_t *FillCrashInfo(const char *dump_dir_name) { + int sv_logmode = logmode; + logmode = 0; /* suppress EPERM/EACCES errors in opendir */ struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ DD_OPEN_READONLY); + logmode = sv_logmode; + if (!dd) return NULL; -- cgit From f8c0e544a905ba42c8b550409f492081534977f5 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 10 Feb 2011 15:48:15 +0100 Subject: get rid of FILENAME_DESCRIPTION, rename "release" to "os_release" Signed-off-by: Denys Vlasenko --- src/cli/CLI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cli/CLI.cpp') diff --git a/src/cli/CLI.cpp b/src/cli/CLI.cpp index 527d5de9..e322e7cd 100644 --- a/src/cli/CLI.cpp +++ b/src/cli/CLI.cpp @@ -160,7 +160,7 @@ static void print_crash_info(crash_data_t *crash_data, bool show_backtrace) get_crash_item_content_or_die(crash_data, FILENAME_PACKAGE), get_crash_item_content_or_die(crash_data, FILENAME_CMDLINE), get_crash_item_content_or_die(crash_data, FILENAME_EXECUTABLE), - get_crash_item_content_or_die(crash_data, FILENAME_RELEASE), + get_crash_item_content_or_die(crash_data, FILENAME_OS_RELEASE), get_crash_item_content_or_die(crash_data, FILENAME_KERNEL), get_crash_item_content_or_die(crash_data, FILENAME_REASON) ); -- cgit From 2abf0fc078221715abbd20c8451d300eaf787848 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 10 Feb 2011 18:04:43 +0100 Subject: abrt-gtk: make Delete key actually delete the dump dir Signed-off-by: Denys Vlasenko --- src/cli/CLI.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src/cli/CLI.cpp') diff --git a/src/cli/CLI.cpp b/src/cli/CLI.cpp index e322e7cd..0e902b9e 100644 --- a/src/cli/CLI.cpp +++ b/src/cli/CLI.cpp @@ -21,9 +21,7 @@ #include #include "abrtlib.h" #include "abrt_dbus.h" -#include "dbus_common.h" #include "report.h" -#include "dbus.h" /** Creates a localized string from crash time. */ static char *localize_crash_time(const char *timestr) @@ -410,11 +408,6 @@ int main(int argc, char** argv) print_usage_and_die(argv[0]); } - DBusError err; - dbus_error_init(&err); - s_dbus_conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err); - handle_dbus_err(s_dbus_conn == NULL, &err); - /* Do the selected operation. */ int exitcode = 0; switch (op) @@ -469,12 +462,10 @@ int main(int argc, char** argv) } dd_close(dd); } + /* Ask abrtd to do it for us */ - exitcode = call_DeleteDebugDump(dump_dir_name); - if (exitcode == ENOENT) - error_msg_and_die("Crash '%s' not found", dump_dir_name); - if (exitcode != 0) - error_msg_and_die("Can't delete debug dump '%s'", dump_dir_name); + exitcode = connect_to_abrtd_and_call_DeleteDebugDump(dump_dir_name); + break; } case OPT_INFO: -- cgit From a330886781635606626b3b91432525128d0e8a8f Mon Sep 17 00:00:00 2001 From: Nikola Pajkovsky Date: Mon, 7 Feb 2011 11:54:07 +0100 Subject: get rid of unused CD_FLAG_SYS Signed-off-by: Nikola Pajkovsky --- src/cli/CLI.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/cli/CLI.cpp') diff --git a/src/cli/CLI.cpp b/src/cli/CLI.cpp index 0e902b9e..2d236e5c 100644 --- a/src/cli/CLI.cpp +++ b/src/cli/CLI.cpp @@ -45,11 +45,8 @@ static crash_data_t *FillCrashInfo(const char *dump_dir_name) return NULL; crash_data_t *crash_data = create_crash_data_from_dump_dir(dd); -// char *events = list_possible_events(dd, NULL, ""); dd_close(dd); -// add_to_crash_data_ext(crash_data, CD_EVENTS, events, CD_FLAG_SYS + CD_FLAG_ISNOTEDITABLE); -// free(events); - add_to_crash_data_ext(crash_data, CD_DUMPDIR, dump_dir_name, CD_FLAG_SYS + CD_FLAG_ISNOTEDITABLE); + add_to_crash_data_ext(crash_data, CD_DUMPDIR, dump_dir_name, CD_FLAG_TXT + CD_FLAG_ISNOTEDITABLE); return crash_data; } @@ -479,7 +476,8 @@ int main(int argc, char** argv) return -1; crash_data_t *crash_data = create_crash_data_from_dump_dir(dd); dd_close(dd); - add_to_crash_data_ext(crash_data, CD_DUMPDIR, dump_dir_name, CD_FLAG_SYS + CD_FLAG_ISNOTEDITABLE); + add_to_crash_data_ext(crash_data, CD_DUMPDIR, dump_dir_name, + CD_FLAG_TXT + CD_FLAG_ISNOTEDITABLE); print_crash_info(crash_data, backtrace); free_crash_data(crash_data); -- cgit From 406b2cffd5e9120bea74ab01479039714ce9e2d5 Mon Sep 17 00:00:00 2001 From: Jiri Moskovcak Date: Thu, 17 Feb 2011 15:44:20 +0100 Subject: move steal_directory() into libreport --- src/cli/CLI.cpp | 41 ----------------------------------------- 1 file changed, 41 deletions(-) (limited to 'src/cli/CLI.cpp') diff --git a/src/cli/CLI.cpp b/src/cli/CLI.cpp index 2d236e5c..b0d6bdf6 100644 --- a/src/cli/CLI.cpp +++ b/src/cli/CLI.cpp @@ -198,47 +198,6 @@ static void print_crash_info(crash_data_t *crash_data, bool show_backtrace) } } -static struct dump_dir *steal_directory(const char *base_dir, const char *dump_dir_name) -{ - const char *base_name = strrchr(dump_dir_name, '/'); - if (base_name) - base_name++; - else - base_name = dump_dir_name; - - struct dump_dir *dd_dst; - unsigned count = 100; - char *dst_dir_name = concat_path_file(base_dir, base_name); - while (1) - { - dd_dst = dd_create(dst_dir_name, (uid_t)-1); - free(dst_dir_name); - if (dd_dst) - break; - if (--count == 0) - { - error_msg("Can't create new dump dir in '%s'", base_dir); - goto ret; - } - struct timeval tv; - gettimeofday(&tv, NULL); - dst_dir_name = xasprintf("%s/%s.%u", base_dir, base_name, (int)tv.tv_usec); - } - - log("Creating copy in '%s'", dd_dst->dd_dir); - if (copy_file_recursive(dump_dir_name, dd_dst->dd_dir) < 0) - { - /* error. copy_file_recursive already emitted error message */ - /* Don't leave half-copied dir lying around */ - dd_delete(dd_dst); - xfunc_die(); - } - - ret: - return dd_dst; -} - - /* Program options */ enum { -- cgit From c00b15ff52f89ada9770453580e5828fd466e9c5 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 25 Feb 2011 15:55:44 +0100 Subject: change stealing semantics from copy to move Signed-off-by: Denys Vlasenko --- src/cli/CLI.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'src/cli/CLI.cpp') diff --git a/src/cli/CLI.cpp b/src/cli/CLI.cpp index b0d6bdf6..593ed6ee 100644 --- a/src/cli/CLI.cpp +++ b/src/cli/CLI.cpp @@ -395,6 +395,7 @@ int main(int argc, char** argv) struct dump_dir *dd_copy = steal_directory((char *)D_list->data, dump_dir_name); if (dd_copy) { + delete_dump_dir_possibly_using_abrtd(dump_dir_name); dump_dir_name = xstrdup(dd_copy->dd_dir); dd_close(dd_copy); } @@ -407,21 +408,7 @@ int main(int argc, char** argv) } case OPT_DELETE: { - /* Try to delete it ourselves */ - struct dump_dir *dd = dd_opendir(dump_dir_name, DD_OPEN_READONLY); - if (dd) - { - if (dd->locked) /* it is not readonly */ - { - dd_delete(dd); - break; - } - dd_close(dd); - } - - /* Ask abrtd to do it for us */ - exitcode = connect_to_abrtd_and_call_DeleteDebugDump(dump_dir_name); - + exitcode = delete_dump_dir_possibly_using_abrtd(dump_dir_name); break; } case OPT_INFO: -- cgit From 3a6d12fcd182c0de13800fe463482d6a4408f885 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 28 Feb 2011 17:23:50 +0100 Subject: dump_dir API: rename dd_dir field to dd_dirname Signed-off-by: Denys Vlasenko --- src/cli/CLI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cli/CLI.cpp') diff --git a/src/cli/CLI.cpp b/src/cli/CLI.cpp index 593ed6ee..5ece3171 100644 --- a/src/cli/CLI.cpp +++ b/src/cli/CLI.cpp @@ -396,7 +396,7 @@ int main(int argc, char** argv) if (dd_copy) { delete_dump_dir_possibly_using_abrtd(dump_dir_name); - dump_dir_name = xstrdup(dd_copy->dd_dir); + dump_dir_name = xstrdup(dd_copy->dd_dirname); dd_close(dd_copy); } } -- cgit