зеркало из https://github.com/github/ruby.git
* 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:
Родитель
77fef79f10
Коммит
c35290824a
|
@ -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>
|
Thu Sep 21 10:07:09 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* string.c (rb_str_partition): RDoc typo fixed. [ruby-core:08898]
|
* 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)
|
#if defined(HAVE_GETPWENT)
|
||||||
VALUE id;
|
VALUE id;
|
||||||
int uid;
|
uid_t uid;
|
||||||
struct passwd *pwd;
|
struct passwd *pwd;
|
||||||
|
|
||||||
rb_secure(4);
|
rb_secure(4);
|
||||||
if (rb_scan_args(argc, argv, "01", &id) == 1) {
|
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 {
|
else {
|
||||||
uid = getuid();
|
uid = getuid();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче