diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-17 16:58:12 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-17 16:58:12 +0000 |
| commit | 9bc9c63d27e45abaabf3a62c6fb0d22a9eaf2f55 (patch) | |
| tree | 1dc5675e2c3ec1a5e43aa53a87ef727cd43a1f0b | |
| parent | 682f161d636a1519ad6d8308a93ca35e37ab3cee (diff) | |
* ext/etc/etc.c (sGroup): getgrent may not be available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@22381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | ext/etc/etc.c | 9 |
2 files changed, 10 insertions, 3 deletions
@@ -1,3 +1,7 @@ +Wed Feb 18 01:58:11 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * ext/etc/etc.c (sGroup): getgrent may not be available. + Tue Feb 17 17:02:45 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> * version.c, version.h: NO_STRING_LITERAL_CONCATENATION support. diff --git a/ext/etc/etc.c b/ext/etc/etc.c index 250e131e01..fe72fa2a8c 100644 --- a/ext/etc/etc.c +++ b/ext/etc/etc.c @@ -27,7 +27,10 @@ #define uid_t int #endif -static VALUE sPasswd, sGroup; +static VALUE sPasswd; +#ifdef HAVE_GETGRENT +static VALUE sGroup; +#endif #ifndef _WIN32 char *getenv(); @@ -139,7 +142,7 @@ etc_getpwuid(argc, argv, obj) uid = getuid(); } pwd = getpwuid(uid); - if (pwd == 0) rb_raise(rb_eArgError, "can't find user for %d", uid); + if (pwd == 0) rb_raise(rb_eArgError, "can't find user for %d", (int)uid); return setup_passwd(pwd); #else return Qnil; @@ -341,7 +344,7 @@ etc_getgrgid(obj, id) rb_secure(4); gid = PW_VAL2GID(id); grp = getgrgid(gid); - if (grp == 0) rb_raise(rb_eArgError, "can't find group for %d", gid); + if (grp == 0) rb_raise(rb_eArgError, "can't find group for %d", (int)gid); return setup_group(grp); #else return Qnil; |
