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 | |
| 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')
| -rw-r--r-- | src/cli/Makefile.am | 5 | ||||
| -rw-r--r-- | src/cli/report.cpp | 19 |
2 files changed, 11 insertions, 13 deletions
diff --git a/src/cli/Makefile.am b/src/cli/Makefile.am index 3584fd6c..9346dd16 100644 --- a/src/cli/Makefile.am +++ b/src/cli/Makefile.am @@ -7,12 +7,13 @@ abrt_cli_SOURCES = \ dbus.h dbus.cpp abrt_cli_CPPFLAGS = \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -I$(srcdir)/../lib \ -DVAR_RUN=\"$(VAR_RUN)\" \ $(ENABLE_SOCKET_OR_DBUS) \ $(DBUS_CFLAGS) $(GLIB_CFLAGS) \ - -D_GNU_SOURCE + -D_GNU_SOURCE \ + -Wall -Werror # $(GTK_CFLAGS) abrt_cli_LDADD = \ 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); |
