summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-09-08 14:17:53 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-09-08 14:17:53 +0000
commit67245eec7192abdc1dd0dc2510c1f6c77df89bd0 (patch)
treefacd3ae86d8ea6fbb70c362cc9a1e22fbaf54b56 /process.c
parent1bcc5eb9223fae41acd88ecacef0aee0d2087e56 (diff)
* eval.c (rb_thread_restore_context): save current value of
lastline and lastmatch in the thread struct for later restore. * eval.c (rb_thread_save_context): restore lastline and lastmatch. * numeric.c (flo_to_s): should handle negative float value. * class.c (rb_include_module): should check whole ancestors to avoid duplicate module inclusion. * string.c (trnext): should check backslash before updating "now" position. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c44
1 files changed, 26 insertions, 18 deletions
diff --git a/process.c b/process.c
index 261edb8..c6c5d4b5 100644
--- a/process.c
+++ b/process.c
@@ -1112,17 +1112,19 @@ proc_setuid(obj, id)
uid = NUM2INT(id);
#if defined(HAVE_SETRESUID) && !defined(__CHECKER__)
- setresuid(uid, -1, -1);
+ if (setresuid(uid, -1, -1) < 0) rb_sys_fail(0);
#elif defined HAVE_SETREUID
- setreuid(uid, -1);
+ if (setreuid(uid, -1) < 0) rb_sys_fail(0);
#elif defined HAVE_SETRUID
- setruid(uid);
+ if (setruid(uid) < 0) rb_sys_fail(0);
#else
{
- if (geteuid() == uid)
- setuid(uid);
- else
+ if (geteuid() == uid) {
+ if (setuid(uid) < 0) rb_sys_fail(0);
+ }
+ else {
rb_notimplement();
+ }
}
#endif
return INT2FIX(uid);
@@ -1144,17 +1146,19 @@ proc_setgid(obj, id)
gid = NUM2INT(id);
#if defined(HAVE_SETRESGID) && !defined(__CHECKER__)
- setresgid(gid, -1, -1);
+ if (setresgid(gid, -1, -1) < 0) rb_sys_fail(0);
#elif defined HAVE_SETREGID
- setregid(gid, -1);
+ if (setregid(gid, -1) < 0) rb_sys_fail(0);
#elif defined HAS_SETRGID
- setrgid((GIDTYPE)gid);
+ if (setrgid((GIDTYPE)gid) < 0) rb_sys_fail(0);
#else
{
- if (getegid() == gid)
- setgid(gid);
- else
+ if (getegid() == gid) {
+ if (setgid(gid) < 0) rb_sys_fail(0);
+ }
+ else {
rb_notimplement();
+ }
}
#endif
return INT2FIX(gid);
@@ -1180,10 +1184,12 @@ proc_seteuid(obj, euid)
if (seteuid(NUM2INT(euid)) < 0) rb_sys_fail(0);
#else
euid = NUM2INT(euid);
- if (euid == getuid())
- setuid(euid);
- else
+ if (euid == getuid()) {
+ if (setuid(euid) < 0) rb_sys_fail(0);
+ }
+ else {
rb_notimplement();
+ }
#endif
return euid;
}
@@ -1209,10 +1215,12 @@ proc_setegid(obj, egid)
if (setegid(NUM2INT(egid)) < 0) rb_sys_fail(0);
#else
egid = NUM2INT(egid);
- if (egid == getgid())
- setgid(egid);
- else
+ if (egid == getgid()) {
+ if (setgid(egid) < 0) rb_sys_fail(0);
+ }
+ else {
rb_notimplement();
+ }
#endif
return egid;
}