[PATCH] shells: set both hard and soft limits by default
Denys Vlasenko
vda.linux at googlemail.com
Tue Jul 27 06:43:36 UTC 2010
On Monday 26 July 2010 15:22, Alexander Shishkin wrote:
> 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 <virtuoso at slind.org>
> ---
> 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;
+26 bytes. Whereas
+ if (!opts)
+ opts = OPT_hard + OPT_soft;
is only +4 bytes.
Applied, thanks!
--
vda
More information about the busybox
mailing list