This commit fixes this warning in api.c:
api.c: In function ‘cgroup_read_value_begin’:
api.c:4114:47: warning: ‘snprintf’ output may be truncated before the
last format character [-Wformat-truncation=]
4114 | snprintf(stat_file, sizeof(stat_file), "%s/%s", stat_path,
| ^
api.c:4114:2: note: ‘snprintf’ output 2 or more bytes (assuming 4097)
into a destination of size 4096
4114 | snprintf(stat_file, sizeof(stat_file), "%s/%s", stat_path,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4115 | name);
| ~~~~~
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
{
int ret = 0;
char *ret_c = NULL;
- char stat_file[FILENAME_MAX];
+ char stat_file[FILENAME_MAX + sizeof(name)];
char stat_path[FILENAME_MAX];
FILE *fp;