* process.c (proc_setuid, proc_setgid, proc_seteuid, proc_setegid):

get rid of bogus implementations on Mac OS X.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2006-08-16 02:46:10 +00:00
Родитель 59f4ea7387
Коммит efff5bc946
2 изменённых файлов: 36 добавлений и 3 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Wed Aug 16 11:45:36 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* process.c (proc_setuid, proc_setgid, proc_seteuid, proc_setegid):
get rid of bogus implementations on Mac OS X.
Wed Aug 16 11:09:26 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ruby.c (set_arg0): fill argv other than the first with an empty

Просмотреть файл

@ -2215,8 +2215,22 @@ proc_setuid(VALUE obj, VALUE id)
*
*/
static int SAVED_USER_ID;
static int SAVED_USER_ID = -1;
#ifdef BROKEN_SETREUID
int
setreuid(rb_uid_t ruid, rb_uid_t euid)
{
if (ruid != -1 && ruid != getuid()) {
if (euid == -1) euid = geteuid();
if (setuid(ruid) < 0) return -1;
}
if (euid != -1 && euid != geteuid()) {
if (seteuid(euid) < 0) return -1;
}
return 0;
}
#endif
/*
* call-seq:
@ -2551,7 +2565,7 @@ proc_setgid(VALUE obj, VALUE id)
#elif defined HAVE_SETREGID
if (setregid(gid, -1) < 0) rb_sys_fail(0);
#elif defined HAVE_SETRGID
if (setrgid((GIDTYPE)gid) < 0) rb_sys_fail(0);
if (setrgid(gid) < 0) rb_sys_fail(0);
#elif defined HAVE_SETGID
{
if (getegid() == gid) {
@ -2807,8 +2821,22 @@ proc_daemon(int argc, VALUE *argv)
*
*/
static int SAVED_GROUP_ID;
static int SAVED_GROUP_ID = -1;
#ifdef BROKEN_SETREGID
int
setregid(rb_gid_t rgid, rb_gid_t egid)
{
if (rgid != -1 && rgid != getgid()) {
if (egid == -1) egid = getegid();
if (setgid(rgid) < 0) return -1;
}
if (egid != -1 && egid != getegid()) {
if (setegid(egid) < 0) return -1;
}
return 0;
}
#endif
/*
* call-seq: