correct old_value in the log info
parent
c2d8faaba7
commit
f776a818f4
2
HISTORY
2
HISTORY
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
Version 1.44 2020-08-05
|
Version 1.44 2020-08-22
|
||||||
* add test file src/tests/test_pthread_lock.c
|
* add test file src/tests/test_pthread_lock.c
|
||||||
* add uniq_skiplist.[hc]
|
* add uniq_skiplist.[hc]
|
||||||
* add function split_string_ex
|
* 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)
|
int set_rlimit(int resource, const rlim_t value)
|
||||||
{
|
{
|
||||||
struct rlimit limit;
|
struct rlimit limit;
|
||||||
|
int64_t old_value;
|
||||||
|
|
||||||
if (getrlimit(resource, &limit) != 0)
|
if (getrlimit(resource, &limit) != 0)
|
||||||
{
|
{
|
||||||
logError("file: "__FILE__", line: %d, " \
|
logError("file: "__FILE__", line: %d, "
|
||||||
"call getrlimit fail, resource=%d, " \
|
"call getrlimit fail, resource=%d, "
|
||||||
"errno: %d, error info: %s", \
|
"errno: %d, error info: %s",
|
||||||
__LINE__, resource, errno, STRERROR(errno));
|
__LINE__, resource, errno, STRERROR(errno));
|
||||||
return errno != 0 ? errno : EPERM;
|
return errno != 0 ? errno : EPERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (limit.rlim_cur == RLIM_INFINITY || \
|
if (limit.rlim_cur == RLIM_INFINITY ||
|
||||||
(value != RLIM_INFINITY && limit.rlim_cur >= value))
|
(value != RLIM_INFINITY && limit.rlim_cur >= value))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
old_value = limit.rlim_cur;
|
||||||
limit.rlim_cur = value;
|
limit.rlim_cur = value;
|
||||||
if (setrlimit(resource, &limit) != 0)
|
if (setrlimit(resource, &limit) != 0)
|
||||||
{
|
{
|
||||||
|
|
@ -1562,8 +1564,7 @@ int set_rlimit(int resource, const rlim_t value)
|
||||||
"call setrlimit fail, resource=%d (%s), "
|
"call setrlimit fail, resource=%d (%s), "
|
||||||
"old value=%"PRId64", new value=%"PRId64", "
|
"old value=%"PRId64", new value=%"PRId64", "
|
||||||
"errno: %d, error info: %s", __LINE__, resource, label,
|
"errno: %d, error info: %s", __LINE__, resource, label,
|
||||||
(int64_t)limit.rlim_cur, (int64_t)value,
|
old_value, (int64_t)value, errno, STRERROR(errno));
|
||||||
errno, STRERROR(errno));
|
|
||||||
return errno != 0 ? errno : EPERM;
|
return errno != 0 ? errno : EPERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue