This commit fixes this warning in api.c:
api.c: In function ‘cgroup_delete_cgroup_ext’:
api.c:2285:51: warning: ‘snprintf’ output may be truncated before the
last format character [-Wformat-truncation=]
2285 | snprintf(child_name, sizeof(child_name), "%s/%s",
| ^
api.c:2285:4: note: ‘snprintf’ output 2 or more bytes (assuming 4097)
into a destination of size 4096
2285 | snprintf(child_name, sizeof(child_name), "%s/%s",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2286 | cgroup_name,
| ~~~~~~~~~~~~
2287 | info.full_path + group_len);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
void *handle;
struct cgroup_file_info info;
int level, group_len;
- char child_name[FILENAME_MAX];
+ char child_name[FILENAME_MAX + 1];
cgroup_dbg("Recursively removing %s:%s\n", controller, cgroup_name);