diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2011-03-18 13:35:40 +0100 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2011-03-18 13:35:40 +0100 |
commit | 95a2b74dc9a4b9de18b8e7e9c28c644bba876778 (patch) | |
tree | 52f45b6467ec81d89da25571e31e48a9797c57c2 /src/lib/dump_dir.c | |
parent | cf9dc0c650065cd5cfc55394d9ee68c9d589e15a (diff) | |
download | abrt-95a2b74dc9a4b9de18b8e7e9c28c644bba876778.tar.gz abrt-95a2b74dc9a4b9de18b8e7e9c28c644bba876778.tar.xz abrt-95a2b74dc9a4b9de18b8e7e9c28c644bba876778.zip |
Replace FILENAME_MESSAGE with FILENAME_REPORTED_TO.
This fixes the problem with abrt-cli not showing unreported bugs
and abrt-gui not showing "green lamp" for reported bugs.
In general, it introduces a way to record reporting results,
such as Bugzilla URL, in dump dir.
In the future, this enables such functions as "check BZ status".
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src/lib/dump_dir.c')
-rw-r--r-- | src/lib/dump_dir.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/lib/dump_dir.c b/src/lib/dump_dir.c index fefec608..045149ac 100644 --- a/src/lib/dump_dir.c +++ b/src/lib/dump_dir.c @@ -731,6 +731,37 @@ void dd_save_binary(struct dump_dir* dd, const char* name, const char* data, uns free(full_path); } +void add_reported_to(struct dump_dir *dd, const char *line) +{ + if (!dd->locked) + error_msg_and_die("dump_dir is not opened"); /* bug */ + + char *reported_to = dd_load_text_ext(dd, FILENAME_REPORTED_TO, DD_FAIL_QUIETLY_ENOENT | DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE); + if (reported_to) + { + unsigned len_line = strlen(line); + char *p = reported_to; + while (*p) + { + if (strncmp(p, line, len_line) == 0 && (p[len_line] == '\n' || p[len_line] == '\0')) + goto ret; + p = strchrnul(p, '\n'); + if (!*p) + break; + p++; + } + if (p != reported_to && p[-1] != '\n') + reported_to = append_to_malloced_string(reported_to, "\n"); + reported_to = append_to_malloced_string(reported_to, line); + reported_to = append_to_malloced_string(reported_to, "\n"); + } + else + reported_to = xasprintf("%s\n", line); + dd_save_text(dd, FILENAME_REPORTED_TO, reported_to); + ret: + free(reported_to); +} + DIR *dd_init_next_file(struct dump_dir *dd) { // if (!dd->locked) |