diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-11-12 15:44:03 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-11-12 15:44:03 +0100 |
commit | f93fc8bc4c4db4547ca7fcdd6ad67f73e1755873 (patch) | |
tree | 8869e5c5bd6c3bfc81c924a000974264fe834339 /src | |
parent | 43761c9351636628da1c37035fa2dcea523cfa80 (diff) | |
download | abrt-f93fc8bc4c4db4547ca7fcdd6ad67f73e1755873.tar.gz abrt-f93fc8bc4c4db4547ca7fcdd6ad67f73e1755873.tar.xz abrt-f93fc8bc4c4db4547ca7fcdd6ad67f73e1755873.zip |
src/Hooks/CCpp.cpp: detect write errors (close() return value); more logging
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/Hooks/CCpp.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Hooks/CCpp.cpp b/src/Hooks/CCpp.cpp index 0f95d05b..3ab8f406 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) { |