diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-12-09 12:29:54 +0100 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-12-09 12:29:54 +0100 |
commit | 28c588d6a86daa3d2f2bb7cdb4604d79e7dcf08b (patch) | |
tree | 7bc2d9c122c4cbf284c338a22a5ddf778cf91176 /src/cli/report.cpp | |
parent | dc3c5b79ba1ee6fd7a98842fde43d072e004f93b (diff) | |
download | abrt-28c588d6a86daa3d2f2bb7cdb4604d79e7dcf08b.tar.gz abrt-28c588d6a86daa3d2f2bb7cdb4604d79e7dcf08b.tar.xz abrt-28c588d6a86daa3d2f2bb7cdb4604d79e7dcf08b.zip |
create report-libs-devel package; separate out report headers
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src/cli/report.cpp')
-rw-r--r-- | src/cli/report.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/cli/report.cpp b/src/cli/report.cpp index 556e06b4..f87486a7 100644 --- a/src/cli/report.cpp +++ b/src/cli/report.cpp @@ -356,15 +356,14 @@ static int run_report_editor(crash_data_t *crash_data) FILE *fp = fdopen(fd, "w"); if (!fp) /* errno is set */ { - perror_msg("can't open '%s' to save the crash report", filename); - return 2; + die_out_of_memory(); } write_crash_report(crash_data, fp); if (fclose(fp)) /* errno is set */ { - perror_msg("can't close '%s'", filename); + perror_msg("can't write '%s'", filename); return 2; } @@ -381,21 +380,18 @@ static int run_report_editor(crash_data_t *crash_data) } fseek(fp, 0, SEEK_END); - long size = ftell(fp); + unsigned long size = ftell(fp); fseek(fp, 0, SEEK_SET); char *text = (char*)xmalloc(size + 1); if (fread(text, 1, size, fp) != size) { error_msg("can't read '%s'", filename); + fclose(fp); return 2; } text[size] = '\0'; - if (fclose(fp) != 0) /* errno is set */ - { - perror_msg("can't close '%s'", filename); - return 2; - } + fclose(fp); // Delete the tempfile. if (unlink(filename) == -1) /* errno is set */ @@ -448,7 +444,8 @@ static bool ask_yesno(const char *question) fflush(NULL); char answer[16]; - fgets(answer, sizeof(answer), stdin); + if (!fgets(answer, sizeof(answer), stdin)) + return false; /* Use strncmp here because the answer might contain a newline as the last char. */ return 0 == strncmp(answer, yes, strlen(yes)); @@ -529,7 +526,7 @@ static GHashTable *get_reporter_plugin_settings(const vector_string_t& reporters /* Load plugin config in the home dir. Do not skip lines * with empty value (but containing a "key="), * because user may want to override password - * from /etc/abrt/plugins/*.conf, but he prefers to + * from /etc/abrt/plugins/foo.conf, but he prefers to * enter it every time he reports. */ map_string_h *single_plugin_settings = new_map_string(); char *path = xasprintf("%s/.abrt/%s.conf", homedir, key); |