1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/etc/etc.c (setup_passwd, setup_group): allow bignum uid, gid and

so on.  [ruby-talk:199102]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2006-06-27 02:37:01 +00:00
parent 8ae45d642f
commit 6de2f53f98
3 changed files with 25 additions and 7 deletions

View file

@ -1,3 +1,8 @@
Tue Jun 27 11:36:02 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/etc/etc.c (setup_passwd, setup_group): allow bignum uid, gid and
so on. [ruby-talk:199102]
Tue Jun 27 10:46:53 2006 Tanaka Akira <akr@m17n.org>
* eval.c (rb_yield_0): avoid core dump. [ruby-dev:28840]

View file

@ -76,18 +76,18 @@ setup_passwd(struct 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),
@ -99,7 +99,7 @@ setup_passwd(struct 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*/
);
@ -301,7 +301,7 @@ setup_group(struct 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

View file

@ -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