diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-02-18 04:13:09 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-02-18 04:13:09 +0000 |
commit | 562f256c54dbb1a0a26699ba3dceba24062a9b11 (patch) | |
tree | 765bda387c202be5cf3db52886842b7d79ba29f7 /ext/etc | |
parent | bf6efa76c0abcd1a2577cf0ca49f8137d3483b60 (diff) | |
download | ruby-562f256c54dbb1a0a26699ba3dceba24062a9b11.tar.gz |
* configure.in (pid_t, uid_t, gid_t): check if defined.
* intern.h, process.c, rubyio.h, ext/etc/etc.c, ext/pty/pty.c: use
rb_{pid,uid,gid}_t instead of plain int. [ruby-dev:30376]
* ext/etc/extconf.rb (PIDT2NUM, NUM2PIDT, UIDT2NUM, NUM2UIDT, GIDT2NUM,
NUM2GIDT): moved to configure.in.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/etc')
-rw-r--r-- | ext/etc/etc.c | 8 | ||||
-rw-r--r-- | ext/etc/extconf.rb | 15 |
2 files changed, 4 insertions, 19 deletions
diff --git a/ext/etc/etc.c b/ext/etc/etc.c index a0e88612a9..54367a0431 100644 --- a/ext/etc/etc.c +++ b/ext/etc/etc.c @@ -76,8 +76,8 @@ setup_passwd(struct passwd *pwd) #ifdef HAVE_ST_PW_PASSWD safe_setup_str(pwd->pw_passwd), #endif - PW_UID2VAL(pwd->pw_uid), - PW_GID2VAL(pwd->pw_gid), + UIDT2NUM(pwd->pw_uid), + GIDT2NUM(pwd->pw_gid), #ifdef HAVE_ST_PW_GECOS safe_setup_str(pwd->pw_gecos), #endif @@ -125,7 +125,7 @@ etc_getpwuid(int argc, VALUE *argv, VALUE obj) rb_secure(4); if (rb_scan_args(argc, argv, "01", &id) == 1) { - uid = PW_VAL2UID(id); + uid = NUM2UIDT(id); } else { uid = getuid(); @@ -301,7 +301,7 @@ setup_group(struct group *grp) #ifdef HAVE_ST_GR_PASSWD safe_setup_str(grp->gr_passwd), #endif - PW_GID2VAL(grp->gr_gid), + GIDT2NUM(grp->gr_gid), mem); } #endif diff --git a/ext/etc/extconf.rb b/ext/etc/extconf.rb index dbd0672545..2914bfb196 100644 --- a/ext/etc/extconf.rb +++ b/ext/etc/extconf.rb @@ -24,20 +24,5 @@ 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') - [%w"uid_t pwd.h", %w"gid_t grp.h"].each do |t, *h| - h.unshift("sys/types.h") - f = "INT2NUM" - if have_type(t, h) - if try_static_assert("sizeof(#{t}) > sizeof(long)", h) - f = "LL2NUM" - end - if try_static_assert("(#{t})-1 > 0", h) - f = "U#{f}" - end - end - t = t.chomp('_t').upcase - $defs.push("-DPW_#{t}2VAL=#{f}") - $defs.push("-DPW_VAL2#{t}=#{f.sub(/([A-Z]+)2(NUM)/, '\22\1')}") - end create_makefile("etc") end |