tzplatform_get: fix to support numeric user id 09/70709/2 accepted/tizen/common/20160526.145939 accepted/tizen/ivi/20160526.094720 accepted/tizen/mobile/20160526.095059 accepted/tizen/tv/20160526.094742 accepted/tizen/wearable/20160526.094908 submit/tizen/20160525.060345
authorsunm.lee <sunm.lee@samsung.com>
Fri, 20 May 2016 07:20:46 +0000 (16:20 +0900)
committersunm.lee <sunm.lee@samsung.com>
Tue, 24 May 2016 23:29:05 +0000 (08:29 +0900)
At implementation of "user" option, the function getpwuid_r()
is used for numeric user id but the variable user is char *
orginally. So to support numeric user id, it should be changed
to integer.

Change-Id: I42d6419075d8ff9f2af0e46a2d6953172b8bf980
Signed-off-by: sunm.lee <sunm.lee@samsung.com>
src/tzplatform_get.c

index b190c34..b37a5eb 100644 (file)
@@ -181,7 +181,7 @@ int main(int argc, char **argv)
                if (user[i])
                        getpwnam_r(user, &pwd, buf, sizeof(buf), &spw);
                else
-                       getpwuid_r(user, &pwd, buf, sizeof(buf), &spw);
+                       getpwuid_r((uid_t)atoi(user), &pwd, buf, sizeof(buf), &spw);
                if (!spw) {
                        fprintf( stderr, "error! %s isn't standing for a valid user.\n", user);
                        if (!cont)