From 1c2e745ff2bd80b14fdf96c28b07ca34e2c16537 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 12 May 2010 14:26:13 +0200 Subject: fix bug 588945 - sparse core files performance hit Signed-off-by: Denys Vlasenko --- src/Hooks/abrt-hook-ccpp.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Hooks/abrt-hook-ccpp.cpp b/src/Hooks/abrt-hook-ccpp.cpp index d21b8e6b..951bea9d 100644 --- a/src/Hooks/abrt-hook-ccpp.cpp +++ b/src/Hooks/abrt-hook-ccpp.cpp @@ -189,7 +189,7 @@ int main(int argc, char** argv) */ snprintf(path, sizeof(path), "%s/abrtd-coredump", dddir); core_fd = xopen3(path, O_WRONLY | O_CREAT | O_TRUNC, 0644); - core_size = copyfd_eof(STDIN_FILENO, core_fd); + core_size = copyfd_eof(STDIN_FILENO, core_fd, COPYFD_SPARSE); if (core_size < 0 || close(core_fd) != 0) { unlink(path); @@ -237,7 +237,7 @@ int main(int argc, char** argv) //Currently it is owned by 0:0 but is readable by anyone, so the owner //of the crashed binary still can access it, as he has //r-x access to the dump dir. - core_size = copyfd_eof(STDIN_FILENO, core_fd); + core_size = copyfd_eof(STDIN_FILENO, core_fd, COPYFD_SPARSE); if (core_size < 0 || fsync(core_fd) != 0) { unlink(path); @@ -367,7 +367,7 @@ int main(int argc, char** argv) /* Note: we do not copy more than ulimit_c */ off_t size; if (ftruncate(usercore_fd, 0) != 0 - || (size = copyfd_size(core_fd, usercore_fd, ulimit_c)) < 0 + || (size = copyfd_size(core_fd, usercore_fd, ulimit_c, COPYFD_SPARSE)) < 0 || close(usercore_fd) != 0 ) { /* perror first, otherwise unlink may trash errno */ -- cgit