aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Shishkin <virtuoso@slind.org>2010-07-27 08:40:55 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-07-27 08:40:55 +0200
commit17e0e43c3522882e2ac8e921132540ba01a1c66c (patch)
treedea5b907947dd291fb756676a6a2095a5f36d374
parent06702365d7faf47ebfc5b5453d73ade235ea4c65 (diff)
downloadbusybox-17e0e43c3522882e2ac8e921132540ba01a1c66c.tar.gz
ulimit: set both hard and soft limits by default
function old new delta shell_builtin_ulimit 494 498 +4 Signed-off-by: Alexander Shishkin <virtuoso@slind.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/shell_common.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/shell/shell_common.c b/shell/shell_common.c
index 3114ff3f7..dc363e298 100644
--- a/shell/shell_common.c
+++ b/shell/shell_common.c
@@ -428,9 +428,14 @@ shell_builtin_ulimit(char **argv)
val <<= l->factor_shift;
}
//bb_error_msg("opt %c val_str:'%s' val:%lld", opt_char, val_str, (long long)val);
+ /* from man bash: "If neither -H nor -S
+ * is specified, both the soft and hard
+ * limits are set. */
+ if (!opts)
+ opts = OPT_hard + OPT_soft;
if (opts & OPT_hard)
limit.rlim_max = val;
- if ((opts & OPT_soft) || opts == 0)
+ if (opts & OPT_soft)
limit.rlim_cur = val;
//bb_error_msg("setrlimit(%d, %lld, %lld)", l->cmd, (long long)limit.rlim_cur, (long long)limit.rlim_max);
if (setrlimit(l->cmd, &limit) < 0) {