X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Futil.c;h=3a82ef7600f53453416eb487b076c4415c1172a4;hp=2d4f2291932963fdfade7286741efe0d6d49deee;hb=ddd88763921a1534081ed28e36f6712a85449005;hpb=034a2a52ac0ec83e0229941d635d310b23eb04df diff --git a/src/util.c b/src/util.c index 2d4f22919..3a82ef760 100644 --- a/src/util.c +++ b/src/util.c @@ -5262,7 +5262,7 @@ int socket_from_display(const char *display, char **path) { int get_user_creds(const char **username, uid_t *uid, gid_t *gid, const char **home) { struct passwd *p; - unsigned long lu; + uid_t u; assert(username); assert(*username); @@ -5281,9 +5281,9 @@ int get_user_creds(const char **username, uid_t *uid, gid_t *gid, const char **h return 0; } - if (safe_atolu(*username, &lu) >= 0) { + if (parse_uid(*username, &u) >= 0) { errno = 0; - p = getpwuid((uid_t) lu); + p = getpwuid(u); /* If there are multiple users with the same id, make * sure to leave $USER to the configured value instead