]> 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:52:53 +0000 (16:52 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Tue, 31 May 2022 22:52:56 +0000 (16:52 -0600)
commit5e06dc20ab01317f20e61746d9b6baea4e9f8c9c
tree8462fd018ccd8b8e6dc9b897df6f6190999c70c3
parente61a3ca6561068ccd31bb816477a8936a4b021e0
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