From e866508e4b35f0fc3b16eb2107dbb3dba42ac23e Mon Sep 17 00:00:00 2001 From: "sunm.lee" Date: Fri, 20 May 2016 16:20:46 +0900 Subject: [PATCH] tzplatform_get: fix to support numeric user id 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 --- src/tzplatform_get.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tzplatform_get.c b/src/tzplatform_get.c index b190c34..b37a5eb 100644 --- a/src/tzplatform_get.c +++ b/src/tzplatform_get.c @@ -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) -- 2.7.4