I didn't dig any farther than the bash manual, which suggests that
the default behavior of ulimit when neither -H nor -S is set is to
change both soft and hard limits. This has been the case in earlier
versions of busybox, too.

Signed-off-by: Alexander Shishkin <[email protected]>
---
 shell/shell_common.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/shell/shell_common.c b/shell/shell_common.c
index 3114ff3..7ddf67b 100644
--- a/shell/shell_common.c
+++ b/shell/shell_common.c
@@ -430,8 +430,13 @@ shell_builtin_ulimit(char **argv)
 //bb_error_msg("opt %c val_str:'%s' val:%lld", opt_char, val_str, (long 
long)val);
                                        if (opts & OPT_hard)
                                                limit.rlim_max = val;
-                                       if ((opts & OPT_soft) || opts == 0)
+                                       if (opts & OPT_soft)
                                                limit.rlim_cur = val;
+                                       /* from man bash: "If neither -H nor -S
+                                        * is specified, both the soft and hard
+                                        * limits are set. */
+                                       if (!opts)
+                                               limit.rlim_max = 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) {
                                                bb_perror_msg("error setting 
limit");
-- 
1.7.1

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to