From 076eb3126de1cfee2e2c3e51aae59c7e14640e8b Mon Sep 17 00:00:00 2001 From: Jiri Moskovcak Date: Tue, 2 Feb 2010 18:32:22 +0100 Subject: fixed premature exit from set_limit() - don't exit if we find corelimit > 0 and don't exit if we can't write new limits --- lib/Plugins/CCpp.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'lib/Plugins/CCpp.cpp') diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp index 0957b39..a090a1d 100644 --- a/lib/Plugins/CCpp.cpp +++ b/lib/Plugins/CCpp.cpp @@ -795,7 +795,7 @@ static int set_limits() fclose(limits_fp); if (!ulimit_c || ulimit_c[0] != '0' || ulimit_c[1] != '\0') { /*process has nonzero ulimit -c, so need to modify it*/ - return 0; + continue; } /* echo -n 'Max core file size=1:unlimited' >/proc/PID/limits */ int fd = open(limits_name, O_WRONLY); @@ -804,17 +804,13 @@ static int set_limits() /*full_*/ ssize_t n = write(fd, CORE_SIZE_PATTERN, sizeof(CORE_SIZE_PATTERN)-1); if (n < sizeof(CORE_SIZE_PATTERN)-1) - log("warning: can't write limit to: %s", limits_name); + log("warning: can't write core_size limit to: %s", limits_name); close(fd); } - else - { - /* - give up when we failed to open /proc//limits for writing - because it probably means, that the kernel doesn't support it - */ - return 1; - } + else + { + log("warning: can't open %s for writing", limits_name); + } } closedir(dir); return 0; -- cgit