summaryrefslogtreecommitdiff
path: root/utils/loc_cfg.cpp
diff options
context:
space:
mode:
authorBhavna Sharma <sbhavna@codeaurora.org>2018-04-20 12:55:17 -0700
committerBhavna Sharma <sbhavna@codeaurora.org>2018-04-20 13:18:43 -0700
commitc2bc68578435b95bf5b1feadb955c22c1ad232cf (patch)
treea7a0579af5c10df0405a6db7b5ababb8c1821d4c /utils/loc_cfg.cpp
parentab95d2dc2e128793d6616f65916e40d25a82cedd (diff)
parent30eb32573c7869cabd7909c33afc48af44baeb42 (diff)
downloadgps-c2bc68578435b95bf5b1feadb955c22c1ad232cf.tar.gz
Merge location.lnx.3.0 into location.lnx.4.0
CRs-Fixed: 2228694 Change-Id: I114d830bec57040d700a0cebac2d0415c9b9f893
Diffstat (limited to 'utils/loc_cfg.cpp')
-rw-r--r--utils/loc_cfg.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/utils/loc_cfg.cpp b/utils/loc_cfg.cpp
index 8037979..6b53188 100644
--- a/utils/loc_cfg.cpp
+++ b/utils/loc_cfg.cpp
@@ -37,7 +37,7 @@
#include <ctype.h>
#include <unistd.h>
#include <time.h>
-#include <pwd.h>
+#include <grp.h>
#include <errno.h>
#include <loc_cfg.h>
#include <loc_pla.h>
@@ -823,18 +823,17 @@ int loc_read_process_conf(const char* conf_file_name, uint32_t * process_count_p
child_proc[j].num_groups = 0;
ngroups = loc_util_split_string(conf.group_list, split_strings, MAX_NUM_STRINGS, ' ');
-#ifdef __ANDROID__
for(i=0; i<ngroups; i++) {
- struct passwd* pwd = getpwnam(split_strings[i]);
- if (pwd) {
- child_proc[j].group_list[i] = pwd->pw_gid;
+ struct group* grp = getgrnam(split_strings[i]);
+ if (grp) {
+ child_proc[j].group_list[i] = grp->gr_gid;
child_proc[j].num_groups++;
LOC_LOGD("%s:%d]:Group %s = %d matches child_group: %d\n",
__func__, __LINE__, split_strings[i],
- pwd->pw_gid,child_proc[j].group_list[i]);
+ grp->gr_gid,child_proc[j].group_list[i]);
}
}
-#endif
+
nstrings = loc_util_split_string(conf.platform_list, split_strings, MAX_NUM_STRINGS, ' ');
if(strcmp("all", split_strings[0]) == 0) {
if (nstrings == 1 || (nstrings == 2 && (strcmp("exclude", split_strings[1]) == 0))) {
@@ -1116,7 +1115,9 @@ int loc_read_process_conf(const char* conf_file_name, uint32_t * process_count_p
}
err:
- fclose(conf_fp);
+ if (conf_fp) {
+ fclose(conf_fp);
+ }
if (ret != 0) {
LOC_LOGE("%s:%d]: ret: %d", __func__, __LINE__, ret);
if (child_proc) {