[Bug 2317] ulimit in 1.17.1 doesn't set more than 1024

bugzilla at busybox.net bugzilla at busybox.net
Tue Aug 3 16:43:19 UTC 2010


https://bugs.busybox.net/show_bug.cgi?id=2317

--- Comment #4 from Denys Fedoryshchenko <denys at visp.net.lb>  ---
Seems i found reason

If i add

                                        if (opts & OPT_hard)
                                                limit.rlim_max = val;
                                        if ((opts & OPT_soft) || opts == 0)
                                                limit.rlim_cur = val;
+                                        if (limit.rlim_max < limit.rlim_cur)
+                                            limit.rlim_max = limit.rlim_cur;
//bb_error_msg("setrlimit(%d, %lld, %lld)", l->cmd, (long long)limit.rlim_cur,
(long long)limit.rlim_max);
                                        printf("Setrlimit call\n");
                                        if (setrlimit(l->cmd, &limit) < 0) {
                                                bb_perror_msg("error setting
limit");

Problem will disappear.
This is how bash do ulimit -n 1025 by strace

getrlimit(RLIMIT_NOFILE, {rlim_cur=1024, rlim_max=1024}) = 0
setrlimit(RLIMIT_NOFILE, {rlim_cur=1025, rlim_max=1025}) = 0

This is how unpatched busybox
getrlimit(RLIMIT_NOFILE, {rlim_cur=1024, rlim_max=1024}) = 0
setrlimit(RLIMIT_NOFILE, {rlim_cur=1025, rlim_max=1024}) = -1 EINVAL (Invalid
argument)

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list