mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/etc/etc.c (etc_getpwuid): uid integer should be wraped in
uid_t value. [ruby-core:08897] * ext/etc/etc.c (etc_getpwuid): uid_t may be bigger than plain 'int' type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
77fef79f10
commit
c35290824a
2 changed files with 19 additions and 2 deletions
|
@ -1,3 +1,11 @@
|
|||
Thu Sep 21 13:55:07 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* ext/etc/etc.c (etc_getpwuid): uid integer should be wraped in
|
||||
uid_t value. [ruby-core:08897]
|
||||
|
||||
* ext/etc/etc.c (etc_getpwuid): uid_t may be bigger than plain
|
||||
'int' type.
|
||||
|
||||
Thu Sep 21 10:07:09 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* string.c (rb_str_partition): RDoc typo fixed. [ruby-core:08898]
|
||||
|
|
|
@ -120,12 +120,21 @@ etc_getpwuid(int argc, VALUE *argv, VALUE obj)
|
|||
{
|
||||
#if defined(HAVE_GETPWENT)
|
||||
VALUE id;
|
||||
int uid;
|
||||
uid_t uid;
|
||||
struct passwd *pwd;
|
||||
|
||||
rb_secure(4);
|
||||
if (rb_scan_args(argc, argv, "01", &id) == 1) {
|
||||
uid = NUM2INT(id);
|
||||
#if HAVE_LONG_LONG && HAVE_TYPE_UID_T
|
||||
if (sizeof(uid_t) > sizeof(int)) {
|
||||
uid = NUM2ULL(id);
|
||||
}
|
||||
else {
|
||||
uid = NUM2UINT(id);
|
||||
}
|
||||
#else
|
||||
uid = NUM2UINT(id);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
uid = getuid();
|
||||
|
|
Loading…
Reference in a new issue