summaryrefslogtreecommitdiff
path: root/ext/etc
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-26 09:07:37 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-26 09:07:37 +0000
commit201eb37d92b9e4729a38a1ea4a7b4cbf2654bd62 (patch)
treeb7e11fcaacb4913f9a3eabdfe5b4a54f491e31f6 /ext/etc
parent860fad971d2bdaad7b9e78adef80f6db9d8ec1cf (diff)
* ext/etc/etc.c (sGroup): getgrent may not be available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/etc')
-rw-r--r--ext/etc/etc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/etc/etc.c b/ext/etc/etc.c
index f09c8d76db..cb850f6987 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -26,7 +26,10 @@
#define uid_t int
#endif
-static VALUE sPasswd, sGroup;
+static VALUE sPasswd;
+#ifdef HAVE_GETGRENT
+static VALUE sGroup;
+#endif
#ifndef _WIN32
char *getenv();
@@ -132,7 +135,7 @@ etc_getpwuid(int argc, VALUE *argv, VALUE 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;
@@ -333,7 +336,7 @@ etc_getgrgid(int argc, VALUE *argv, VALUE obj)
gid = getgid();
}
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;