diff options
author | Harikrishnan Hariharan <hahariha@codeaurora.org> | 2018-02-13 16:04:32 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-03-01 02:58:14 -0800 |
commit | c645cb167bfb81a8646da19457573b00534a6e7c (patch) | |
tree | eff78befb4e94cf37bbc37b6eca967f2a15d288c /utils/loc_cfg.cpp | |
parent | 25bf85b355027f133118521786f833cf785bef04 (diff) | |
download | gps-c645cb167bfb81a8646da19457573b00534a6e7c.tar.gz |
Define gps user and group id's for Android and LE.
- Define gps user and group id's for Android and LE.
- Update to use getgrnam for getting group id's.
- Get group id's for child processes for LE also.
Change-Id: I5365dbc1c51eb89ab66ba8652f3ed1c5dbea6eb4
CRs-Fixed: 2183710
Diffstat (limited to 'utils/loc_cfg.cpp')
-rw-r--r-- | utils/loc_cfg.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/utils/loc_cfg.cpp b/utils/loc_cfg.cpp index 884bb10..3e1922c 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> @@ -826,18 +826,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))) { |