summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-06-27 02:37:01 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-06-27 02:37:01 +0000
commitee20ef1e0a960417edcb283d424ecb997174d5a3 (patch)
tree5b2bea451bbae6a4eb70b82ea60b6431de073cb4 /ext
parent6895ad08eb8ff4b4b22d1774e08bcc9cd64116aa (diff)
downloadruby-ee20ef1e0a960417edcb283d424ecb997174d5a3.tar.gz
ruby-ee20ef1e0a960417edcb283d424ecb997174d5a3.tar.xz
ruby-ee20ef1e0a960417edcb283d424ecb997174d5a3.zip
* ext/etc/etc.c (setup_passwd, setup_group): allow bignum uid, gid and
so on. [ruby-talk:199102] git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@10408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/etc/etc.c12
-rw-r--r--ext/etc/extconf.rb15
2 files changed, 20 insertions, 7 deletions
diff --git a/ext/etc/etc.c b/ext/etc/etc.c
index ac9573554..c79640d02 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -79,18 +79,18 @@ setup_passwd(pwd)
#ifdef HAVE_ST_PW_PASSWD
safe_setup_str(pwd->pw_passwd),
#endif
- INT2FIX(pwd->pw_uid),
- INT2FIX(pwd->pw_gid),
+ PW_UID2VAL(pwd->pw_uid),
+ PW_GID2VAL(pwd->pw_gid),
#ifdef HAVE_ST_PW_GECOS
safe_setup_str(pwd->pw_gecos),
#endif
safe_setup_str(pwd->pw_dir),
safe_setup_str(pwd->pw_shell),
#ifdef HAVE_ST_PW_CHANGE
- INT2FIX(pwd->pw_change),
+ INT2NUM(pwd->pw_change),
#endif
#ifdef HAVE_ST_PW_QUOTA
- INT2FIX(pwd->pw_quota),
+ INT2NUM(pwd->pw_quota),
#endif
#ifdef HAVE_ST_PW_AGE
PW_AGE2VAL(pwd->pw_age),
@@ -102,7 +102,7 @@ setup_passwd(pwd)
safe_setup_str(pwd->pw_comment),
#endif
#ifdef HAVE_ST_PW_EXPIRE
- INT2FIX(pwd->pw_expire),
+ INT2NUM(pwd->pw_expire),
#endif
0 /*dummy*/
);
@@ -313,7 +313,7 @@ setup_group(grp)
#ifdef HAVE_ST_GR_PASSWD
safe_setup_str(grp->gr_passwd),
#endif
- INT2FIX(grp->gr_gid),
+ PW_GID2VAL(grp->gr_gid),
mem);
}
#endif
diff --git a/ext/etc/extconf.rb b/ext/etc/extconf.rb
index 0dc8e7dda..5cdb824fd 100644
--- a/ext/etc/extconf.rb
+++ b/ext/etc/extconf.rb
@@ -24,6 +24,19 @@ if a or b or c
have_struct_member('struct passwd', 'pw_expire', 'pwd.h')
have_struct_member('struct passwd', 'pw_passwd', 'pwd.h')
have_struct_member('struct group', 'gr_passwd', 'grp.h')
- have_type("uid_t");
+ [%w"uid_t pwd.h", %w"gid_t grp.h"].each do |t, *h|
+ h << "sys/types.h"
+ if have_type(t, h)
+ if try_static_assert("sizeof(#{t}) > sizeof(long)", h)
+ f = "LL2NUM"
+ else
+ f = "INT2NUM"
+ end
+ if try_static_assert("(#{t})-1 > 0", h)
+ f = "U#{f}"
+ end
+ $defs.push("-DPW_#{t.chomp('_t').upcase}2VAL=#{f}")
+ end
+ end
create_makefile("etc")
end