diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-03-09 12:39:02 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-03-09 12:39:02 +0100 |
commit | b5b4d3ab76449493cfe3f58b7a7234de44f49e30 (patch) | |
tree | 7de8786b4ffdd789fed9aaf1d496d16e9fdc400b /src/CLI/CLI.cpp | |
parent | fc8eb70f3446578a4dd632ede5c1347c0b3ece5b (diff) | |
download | abrt-b5b4d3ab76449493cfe3f58b7a7234de44f49e30.tar.gz abrt-b5b4d3ab76449493cfe3f58b7a7234de44f49e30.tar.xz abrt-b5b4d3ab76449493cfe3f58b7a7234de44f49e30.zip |
cli: make --report UUIDprefix match only unique prfix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'src/CLI/CLI.cpp')
-rw-r--r-- | src/CLI/CLI.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/CLI/CLI.cpp b/src/CLI/CLI.cpp index fcf1f0cd..c417619c 100644 --- a/src/CLI/CLI.cpp +++ b/src/CLI/CLI.cpp @@ -102,19 +102,24 @@ static char *guess_crash_id(const char *str) unsigned len = strlen(str); unsigned ii; + char *result = NULL; for (ii = 0; ii < num_crashinfos; ii++) { map_crash_data_t& info = ci[ii]; const char *this_uuid = get_crash_data_item_content(info, CD_UUID).c_str(); if (strncmp(str, this_uuid, len) == 0) { - return xasprintf("%s:%s", + if (result) + error_msg_and_die("Crash prefix '%s' is not unique", str); + result = xasprintf("%s:%s", get_crash_data_item_content(info, CD_UID).c_str(), this_uuid ); } } - error_msg_and_die("Crash '%s' not found", str); + if (!result) + error_msg_and_die("Crash '%s' not found", str); + return result; } static const struct option longopts[] = @@ -156,9 +161,9 @@ static void usage(char *argv0) " --report CRASH_ID create and send a report\n" " --report-always CRASH_ID create and send a report without asking\n" " --delete CRASH_ID remove crash\n" - "CRASH_ID may be:\n" - " an UID:UUID pair,\n" - " an UUID prefix - the first crash with matching UUID will be acted upon\n" + "CRASH_ID can be:\n" + " UID:UUID pair,\n" + " unique UUID prefix - the crash with matching UUID will be acted upon\n" " @N - N'th crash (as displayed by --get-list-full) will be acted upon\n" ), name, name); |