summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Moskovcak <jmoskovc@redhat.com>2010-02-02 18:32:22 +0100
committerJiri Moskovcak <jmoskovc@redhat.com>2010-02-02 18:32:22 +0100
commit076eb3126de1cfee2e2c3e51aae59c7e14640e8b (patch)
tree8be8880b48730f3e8d6c02d46ec812b310ec3e6b
parent413bf193a4209623ec756287575f58bcc4889733 (diff)
downloadabrt-076eb3126de1cfee2e2c3e51aae59c7e14640e8b.tar.gz
abrt-076eb3126de1cfee2e2c3e51aae59c7e14640e8b.tar.xz
abrt-076eb3126de1cfee2e2c3e51aae59c7e14640e8b.zip
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
-rw-r--r--lib/Plugins/CCpp.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp
index 0957b395..a090a1df 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/<pid>/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;