]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
api: fix build warning
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Fri, 23 Jun 2023 09:40:00 +0000 (15:10 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Mon, 26 Jun 2023 15:56:22 +0000 (09:56 -0600)
commite1e2f05442df27295411134dddca024d7398e55f
tree73337ebb7422621025ec7644f218ed09566302df
parent9be563218aba0de080cd4beefb46beec8d620d5d
api: fix build warning

Fix a build warning:
cgcreate.c: In function ‘create_systemd_scope’:
cgcreate.c:81:17: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-truncation]
   81 |                 strncpy(slice, cg->name, len);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cgcreate.c:80:23: note: length computed here
   80 |                 len = strlen(cg->name) - strlen(scope);

fix it by using, length of destination in the strncpy().

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/tools/cgcreate.c