提交 d9b914ea 编写于 作者: Y YuQing

set rlim_max for setrlimit call

上级 98b816c6
......@@ -1510,7 +1510,7 @@ int set_rlimit(int resource, const rlim_t value)
return errno != 0 ? errno : EPERM;
}
if (limit.rlim_cur == RLIM_INFINITY ||
if ((limit.rlim_cur == RLIM_INFINITY) ||
(value != RLIM_INFINITY && limit.rlim_cur >= value))
{
return 0;
......@@ -1518,6 +1518,11 @@ int set_rlimit(int resource, const rlim_t value)
old_value = limit.rlim_cur;
limit.rlim_cur = value;
if (!((limit.rlim_max == RLIM_INFINITY) ||
(value != RLIM_INFINITY && limit.rlim_max >= value)))
{
limit.rlim_max = value;
}
if (setrlimit(resource, &limit) != 0)
{
const char *label;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册