summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>2011-05-18 13:53:52 +0200
committerDenys Vlasenko <dvlasenk@redhat.com>2011-05-18 13:53:52 +0200
commitae2071616ab4dad41c3f687782b2e4562bc5b7f1 (patch)
tree0597ab08ac40062ab313a0f91b6c14cc97977f1d
parent826900355023fcfef39cc91721e681cf558a11f6 (diff)
downloadabrt-ae2071616ab4dad41c3f687782b2e4562bc5b7f1.tar.gz
abrt-ae2071616ab4dad41c3f687782b2e4562bc5b7f1.tar.xz
abrt-ae2071616ab4dad41c3f687782b2e4562bc5b7f1.zip
hook: truncate coredump in PWD to ulimit -c
If MakeCompatCore = yes, coredumps are generated in user's current working directory for compatibility with the original kernel coredumper. This patch fixes the difference between ABRT and the original that: original kernel coredumper truncates coredump to ulimit -c, not to (ulimit-c - 1). Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com> Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
-rw-r--r--src/hooks/abrt-hook-ccpp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/hooks/abrt-hook-ccpp.c b/src/hooks/abrt-hook-ccpp.c
index e2c1b373..12b9509f 100644
--- a/src/hooks/abrt-hook-ccpp.c
+++ b/src/hooks/abrt-hook-ccpp.c
@@ -626,7 +626,7 @@ int main(int argc, char** argv)
error_msg_and_die("error writing %s", path);
}
log("saved core dump of pid %lu (%s) to %s (%llu bytes)", (long)pid, executable, path, (long long)core_size);
- if (user_core_fd >= 0 && core_size >= ulimit_c)
+ if (user_core_fd >= 0 && (ulimit_c == 0 || core_size > ulimit_c))
{
/* user coredump is too big, nuke it */
xchdir(user_pwd);
@@ -668,7 +668,7 @@ int main(int argc, char** argv)
unlink(core_basename);
return 1;
}
- if (core_size >= ulimit_c)
+ if (ulimit_c == 0 || core_size > ulimit_c)
{
xchdir(user_pwd);
unlink(core_basename);