* process.c (setreuid, setregid): suppress warnings.

[ruby-core:43374][Bug #6169]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-04-03 09:33:40 +00:00
Родитель 31bd33a662
Коммит ca512bdaa8
2 изменённых файлов: 13 добавлений и 6 удалений

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

@ -1,3 +1,8 @@
Tue Apr 3 18:33:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* process.c (setreuid, setregid): suppress warnings.
[ruby-core:43374][Bug #6169]
Tue Apr 3 10:18:27 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* enumerator.c (inspect_enumerator): suppress uninitialized

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

@ -113,9 +113,11 @@ static VALUE rb_cProcessTms;
#ifdef BROKEN_SETREUID
#define setreuid ruby_setreuid
int setreuid(rb_uid_t ruid, rb_uid_t euid);
#endif
#ifdef BROKEN_SETREGID
#define setregid ruby_setregid
int setregid(rb_gid_t rgid, rb_gid_t egid);
#endif
#if defined(HAVE_44BSD_SETUID) || defined(__MacOS_X__)
@ -4307,11 +4309,11 @@ static rb_uid_t SAVED_USER_ID = -1;
int
setreuid(rb_uid_t ruid, rb_uid_t euid)
{
if (ruid != -1 && ruid != getuid()) {
if (euid == -1) euid = geteuid();
if (ruid != (rb_uid_t)-1 && ruid != getuid()) {
if (euid == (rb_uid_t)-1) euid = geteuid();
if (setuid(ruid) < 0) return -1;
}
if (euid != -1 && euid != geteuid()) {
if (euid != (rb_uid_t)-1 && euid != geteuid()) {
if (seteuid(euid) < 0) return -1;
}
return 0;
@ -5010,11 +5012,11 @@ static rb_gid_t SAVED_GROUP_ID = -1;
int
setregid(rb_gid_t rgid, rb_gid_t egid)
{
if (rgid != -1 && rgid != getgid()) {
if (egid == -1) egid = getegid();
if (rgid != (rb_gid_t)-1 && rgid != getgid()) {
if (egid == (rb_gid_t)-1) egid = getegid();
if (setgid(rgid) < 0) return -1;
}
if (egid != -1 && egid != getegid()) {
if (egid != (rb_gid_t)-1 && egid != getegid()) {
if (setegid(egid) < 0) return -1;
}
return 0;