X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fisadmin.c;h=f62a449c67bd521decea7e9e142abcdc3c8a44f6;hb=a9dd2a16b8b5677b0ad4ea19fb2689fbb5ef88a4;hp=903ebe2e9cd67cb70b5a2e808902679b326d2c7d;hpb=1c293b65be39845efaef0a4963b8e72c7cd29bd4;p=platform%2Fcore%2Fsystem%2Ftizen-platform-wrapper.git diff --git a/src/isadmin.c b/src/isadmin.c index 903ebe2..f62a449 100644 --- a/src/isadmin.c +++ b/src/isadmin.c @@ -40,11 +40,12 @@ #include "tzplatform_variables.h" #include "tzplatform_config.h" -int _is_admin_static_(uid_t uid) { +int _has_system_group_static_(uid_t uid) { - struct passwd *userinfo = NULL; - struct group *systemgroupinfo = NULL; + struct passwd pwd, *userinfo = NULL; + struct group grp, *systemgroupinfo = NULL; const char *sysgrpname = NULL; + char buf[1024]; uid_t myuid = 0; gid_t system_gid = 0; gid_t *groups = NULL; @@ -63,7 +64,7 @@ int _is_admin_static_(uid_t uid) { fprintf( stderr, "isadmin ERROR: variable TZ_SYS_ADMIN_GROUP is NULL"); return -1; } - systemgroupinfo = getgrnam(sysgrpname); + getgrnam_r(sysgrpname, &grp, buf, sizeof(buf), &systemgroupinfo); if(systemgroupinfo == NULL) { fprintf( stderr, "isadmin ERROR: cannot find group named \"%s\"\n", sysgrpname); return -1; @@ -73,7 +74,7 @@ int _is_admin_static_(uid_t uid) { /* Get all the gid of the given uid */ - userinfo = getpwuid(myuid); + getpwuid_r(myuid, &pwd, buf, sizeof(buf), &userinfo); /* Need to call this function now to get the number of group to make the malloc correctly sized */