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 <[email protected]>
---
src/api.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/api.c b/src/api.c
index 5c347fadbd83..30962fcccba6 100644
--- a/src/api.c
+++ b/src/api.c
@@ -2257,7 +2257,7 @@ static int cg_delete_cgroup_controller_recursive(char
*cgroup_name,
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);
--
1.8.3.1
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel