]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
config: add missing ret value check from getgrnam_r()
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Tue, 31 May 2022 22:51:21 +0000 (16:51 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Tue, 31 May 2022 22:51:25 +0000 (16:51 -0600)
commit18cc60ddf3cba088fce3062099d8ee5fca5341a0
treecf44670468b427ac6f4ea2c69edd6df18e3f454c
parent9ba6fdec08044b19bcfcbb3a71db1905dd391283
config: add missing ret value check from getgrnam_r()

Fix Unchecked return values from library, reported by Coverity tool:

CID 258287 (#1 of 1): Unchecked return value from library
(CHECKED_RETURN).
check_return: Calling getgrnam_r(value, group, buffer, 20480UL,
&group_buffer) without checking return value. This library function may
fail and return an error code.

CID 258303 (#1 of 1): Unchecked return value from library
(CHECKED_RETURN).
check_return: Calling getgrnam_r(value, group, buffer, 20480UL,
&group_buffer) without checking return value. This library function may
fail and return an error code.

Coverity expects us to check for return value from getgrnam_r(), instead
of the current for group_buffer != NULL.  Which is right, let's make
Coverity happy by moving the check to return value.

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