cgfsng: s/25/INTTYPE_TO_STRLEN(pid_t)/g

parent 5ce03bc0
...@@ -1465,10 +1465,10 @@ __cgfsng_ops static bool __do_cgroup_enter(struct cgroup_ops *ops, pid_t pid, ...@@ -1465,10 +1465,10 @@ __cgfsng_ops static bool __do_cgroup_enter(struct cgroup_ops *ops, pid_t pid,
bool monitor) bool monitor)
{ {
int len; int len;
char pidstr[25]; char pidstr[INTTYPE_TO_STRLEN(pid_t)];
len = snprintf(pidstr, 25, "%d", pid); len = snprintf(pidstr, sizeof(pidstr), "%d", pid);
if (len < 0 || len >= 25) if (len < 0 || (size_t)len >= sizeof(pidstr))
return false; return false;
for (int i = 0; ops->hierarchies[i]; i++) { for (int i = 0; ops->hierarchies[i]; i++) {
...@@ -2097,10 +2097,10 @@ __cgfsng_ops static bool cgfsng_attach(struct cgroup_ops *ops, const char *name, ...@@ -2097,10 +2097,10 @@ __cgfsng_ops static bool cgfsng_attach(struct cgroup_ops *ops, const char *name,
const char *lxcpath, pid_t pid) const char *lxcpath, pid_t pid)
{ {
int i, len, ret; int i, len, ret;
char pidstr[25]; char pidstr[INTTYPE_TO_STRLEN(pid_t)];
len = snprintf(pidstr, 25, "%d", pid); len = snprintf(pidstr, sizeof(pidstr), "%d", pid);
if (len < 0 || len >= 25) if (len < 0 || (size_t)len >= sizeof(pidstr))
return false; return false;
for (i = 0; ops->hierarchies[i]; i++) { for (i = 0; ops->hierarchies[i]; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment