提交 f776a818 编写于 作者: Y YuQing

correct old_value in the log info

上级 c2d8faab
Version 1.44 2020-08-05
Version 1.44 2020-08-22
* add test file src/tests/test_pthread_lock.c
* add uniq_skiplist.[hc]
* add function split_string_ex
......
......@@ -1499,22 +1499,24 @@ int fd_gets(int fd, char *buff, const int size, int once_bytes)
int set_rlimit(int resource, const rlim_t value)
{
struct rlimit limit;
int64_t old_value;
if (getrlimit(resource, &limit) != 0)
{
logError("file: "__FILE__", line: %d, " \
"call getrlimit fail, resource=%d, " \
"errno: %d, error info: %s", \
logError("file: "__FILE__", line: %d, "
"call getrlimit fail, resource=%d, "
"errno: %d, error info: %s",
__LINE__, resource, errno, STRERROR(errno));
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;
}
old_value = limit.rlim_cur;
limit.rlim_cur = value;
if (setrlimit(resource, &limit) != 0)
{
......@@ -1562,8 +1564,7 @@ int set_rlimit(int resource, const rlim_t value)
"call setrlimit fail, resource=%d (%s), "
"old value=%"PRId64", new value=%"PRId64", "
"errno: %d, error info: %s", __LINE__, resource, label,
(int64_t)limit.rlim_cur, (int64_t)value,
errno, STRERROR(errno));
old_value, (int64_t)value, errno, STRERROR(errno));
return errno != 0 ? errno : EPERM;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册