summaryrefslogtreecommitdiff
path: root/ext/etc/etc.c
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-01-12 02:27:43 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-01-12 02:27:43 +0000
commit81246910f22e42a1dbe7ae82c893e52b39c86b92 (patch)
tree20d4812bb98ba1e847df39d88a074764bc8753e2 /ext/etc/etc.c
parent4651a1b94cd8d84a0bbc45729ddf0432adcf4fcd (diff)
* ext/etc/etc.c (etc_getpwuid, etc_getgrgid): fix to correctly
convert uid/gid from VALUE. (backport of r11521) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/etc/etc.c')
-rw-r--r--ext/etc/etc.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/ext/etc/etc.c b/ext/etc/etc.c
index c9ed3d5293..447d833bc7 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -131,16 +131,7 @@ etc_getpwuid(argc, argv, obj)
rb_secure(4);
if (rb_scan_args(argc, argv, "01", &id) == 1) {
-#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
+ uid = PW_VAL2UID(id);
}
else {
uid = getuid();
@@ -342,11 +333,11 @@ etc_getgrgid(obj, id)
VALUE obj, id;
{
#ifdef HAVE_GETGRENT
- int gid;
+ gid_t gid;
struct group *grp;
rb_secure(4);
- gid = NUM2INT(id);
+ gid = getgid();
grp = getgrgid(gid);
if (grp == 0) rb_raise(rb_eArgError, "can't find group for %d", gid);
return setup_group(grp);