diff options
author | INSUN PYO <insun.pyo@samsung.com> | 2017-10-27 13:06:19 +0900 |
---|---|---|
committer | INSUN PYO <insun.pyo@samsung.com> | 2017-10-27 13:07:01 +0900 |
commit | 0b0542db583d2c501193243e106a56ecb270f0a8 (patch) | |
tree | 92138bd35caa3cabef74dabbf5d2a71ee0b51d1d | |
parent | 74408fbb9c59cece3d3d9a3f15d5420439551f84 (diff) | |
download | tizen-platform-config-0b0542db583d2c501193243e106a56ecb270f0a8.tar.gz tizen-platform-config-0b0542db583d2c501193243e106a56ecb270f0a8.tar.bz2 tizen-platform-config-0b0542db583d2c501193243e106a56ecb270f0a8.zip |
Coverity fixes.
Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: I3a0e8c8edf5134810b482bfcaa77d298e80bd677
-rw-r--r-- | src/isadmin.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/isadmin.c b/src/isadmin.c index ebe98ad..8d77f3f 100644 --- a/src/isadmin.c +++ b/src/isadmin.c @@ -73,7 +73,15 @@ int _has_system_group_static_(uid_t uid) /* Get all the gid of the given uid */ - getpwuid_r(myuid, &pwd, buf, sizeof(buf), &userinfo); + if (getpwuid_r(myuid, &pwd, buf, sizeof(buf), &userinfo)) { + fprintf(stderr, "isadmin ERROR: cannot get password file entry\n"); + return -1; + } + + if (userinfo == NULL) { + fprintf(stderr, "isadmin ERROR: no matching password record\n"); + return -1; + } /* Need to call this function now to get the number of group to make the malloc correctly sized */ |