From: Junghyun Yeon Date: Tue, 25 Aug 2020 05:03:51 +0000 (+0900) Subject: Fix static analysis issue X-Git-Tag: submit/tizen/20200908.025700~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2d521e840343736062c592018c1b9de1d5220da4;p=platform%2Fcore%2Fappfw%2Fapp-installers.git Fix static analysis issue Change-Id: Iedeeb275edaa9b09e3a2ff7af88c88b5adfdbfb2 Signed-off-by: Junghyun Yeon --- diff --git a/src/common/utils/user_util.cc b/src/common/utils/user_util.cc index 93384e6a..d030ba4d 100644 --- a/src/common/utils/user_util.cc +++ b/src/common/utils/user_util.cc @@ -130,9 +130,8 @@ boost::optional GetGidByGroupName(const char* groupname) { struct group entry; struct group* ge; int ret = getgrnam_r(groupname, &entry, buf, sizeof(buf), &ge); - if (ret || ge == nullptr) { - return result; - } + if (ret || ge == nullptr) + return {}; result = entry.gr_gid; return result; } @@ -164,7 +163,7 @@ boost::optional GetGidByUid(uid_t uid) { char buf[kPWBufSize]; int ret = getpwuid_r(uid, &pwd, buf, sizeof(buf), &pwd_result); if (ret != 0 || pwd_result == nullptr) - return result; + return {}; result = pwd.pw_gid; return result; }