]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
api.c: cg_build_path_locked() - work around snprintf() warnings
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Wed, 8 Feb 2023 06:55:10 +0000 (12:25 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Fri, 10 Feb 2023 21:13:16 +0000 (14:13 -0700)
commite751b3236c7ed2544e49f377bb6356872b313c31
tree71f869404839abb2419e47133ac8391892d88973
parenta83e05513108022293aa2c40ee3a5bbfae18f451
api.c: cg_build_path_locked() - work around snprintf() warnings

Recent gcc are unhappy when sizeof(dest) <= sizeof(src) with
snprintf()'s. We could need too many strncpy()'s and strcat()'s for
constructing file path, so let's workaround it by allocating long
enough space for keeping snprintf() happy and then use the temporarily
allocated array and use it as src for strncpy() with limit of
FILENAME_MAX.

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