From f93fc8bc4c4db4547ca7fcdd6ad67f73e1755873 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 12 Nov 2009 15:44:03 +0100 Subject: src/Hooks/CCpp.cpp: detect write errors (close() return value); more logging Signed-off-by: Denys Vlasenko --- src/Hooks/CCpp.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Hooks/CCpp.cpp b/src/Hooks/CCpp.cpp index 0f95d05..3ab8f40 100644 --- a/src/Hooks/CCpp.cpp +++ b/src/Hooks/CCpp.cpp @@ -205,19 +205,19 @@ int main(int argc, char** argv) dd.Close(); perror_msg_and_die("can't open '%s'", path); } - if (copyfd_eof(STDIN_FILENO, fd) < 0) + off_t size = copyfd_eof(STDIN_FILENO, fd); + if (size < 0 || close(fd) != 0) { - /* close(fd); - why bother? */ + unlink(path); dd.Delete(); dd.Close(); /* copyfd_eof logs the error including errno string, * but it does not log file name */ error_msg_and_die("error saving coredump to %s", path); } - /* close(fd); - why bother? */ - /* free(executable); */ + /* free(executable); - why bother? */ /* free(cmdline); */ - log("saved core dump of pid %u to %s", (int)pid, path); + log("saved core dump of pid %u to %s (%llu bytes)", (int)pid, path, (long long)size); } catch (CABRTException& e) { -- cgit From 3c50cb18a117201176b300eca1a8c2df938bb0b3 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 12 Nov 2009 18:13:47 +0100 Subject: disable compilation of the rest of socket code Signed-off-by: Denys Vlasenko --- src/CLI/Makefile.am | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/CLI/Makefile.am b/src/CLI/Makefile.am index dbeb1c3..e84d426 100644 --- a/src/CLI/Makefile.am +++ b/src/CLI/Makefile.am @@ -1,15 +1,11 @@ bin_PROGRAMS = abrt-cli +# removed: ABRTSocket.h ABRTSocket.cpp abrt_cli_SOURCES = \ CLI.cpp \ - ABRTSocket.h \ - ABRTSocket.cpp \ - run-command.h \ - run-command.cpp \ - report.h \ - report.cpp \ - dbus.h \ - dbus.cpp + run-command.h run-command.cpp \ + report.h report.cpp \ + dbus.h dbus.cpp abrt_cli_CPPFLAGS = \ -I$(srcdir)/../../inc \ -- cgit From f8196efffcf8fc5eea3519bef4e010098e78e89d Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 12 Nov 2009 18:31:57 +0100 Subject: src/Hooks/CCpp.cpp: clarify error message Signed-off-by: Denys Vlasenko --- src/Hooks/CCpp.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/Hooks/CCpp.cpp b/src/Hooks/CCpp.cpp index 3ab8f40..81cd77a 100644 --- a/src/Hooks/CCpp.cpp +++ b/src/Hooks/CCpp.cpp @@ -164,22 +164,20 @@ int main(int argc, char** argv) try { - char* executable; - char* cmdline; - executable = get_executable(pid); - cmdline = get_cmdline(pid); - if (executable == NULL || cmdline == NULL) + char* executable = get_executable(pid); + if (executable == NULL) { - error_msg_and_die("can not get proc info for pid %u", (int)pid); + error_msg_and_die("can't read /proc/%u/exe link", (int)pid); } if (strstr(executable, "/abrt")) { /* free(executable); - why bother? */ - /* free(cmdline); */ error_msg_and_die("pid %u is '%s', not dumping it to avoid abrt recursion", (int)pid, executable); } + char* cmdline = get_cmdline(pid); /* never NULL */ + char path[PATH_MAX]; snprintf(path, sizeof(path), "%s/ccpp-%ld-%u", dddir, (long)time(NULL), (int)pid); -- cgit From ef2c11ac4b8a89f5e471a16e665733a319f273fb Mon Sep 17 00:00:00 2001 From: Jiri Moskovcak Date: Thu, 12 Nov 2009 21:47:07 +0100 Subject: build fixes --- src/CLI/CLI.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/CLI/CLI.cpp b/src/CLI/CLI.cpp index edc8df0..149e936 100644 --- a/src/CLI/CLI.cpp +++ b/src/CLI/CLI.cpp @@ -17,7 +17,6 @@ */ #include #include "ABRTException.h" -#include "ABRTSocket.h" #include "abrtlib.h" #include "abrt_dbus.h" #include "DBusCommon.h" -- cgit