Created
September 20, 2012 18:12
-
-
Save endemics/3757463 to your computer and use it in GitHub Desktop.
allowing hard and soft limit changes in chpst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- src/chpst.c.orig 2009-10-04 22:44:02.000000000 +0200 | |
+++ src/chpst.c 2012-09-20 20:53:01.000000000 +0200 | |
@@ -168,7 +168,13 @@ | |
struct rlimit r; | |
if (getrlimit(what, &r) == -1) fatal("unable to getrlimit()"); | |
- if ((l < 0) || (l > r.rlim_max)) | |
+ if (l > r.rlim_max) { | |
+ if (geteuid() == 0) | |
+ r.rlim_cur =r.rlim_max =l; | |
+ else | |
+ r.rlim_cur =r.rlim_max; | |
+ } | |
+ else if (l < 0) | |
r.rlim_cur =r.rlim_max; | |
else | |
r.rlim_cur =l; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment