summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rw-r--r--configure.in3
-rw-r--r--eval.c6
-rw-r--r--intern.h10
-rw-r--r--process.c38
-rw-r--r--ruby.h22
-rw-r--r--win32/win32.h4
7 files changed, 58 insertions, 39 deletions
diff --git a/ChangeLog b/ChangeLog
index 07d6c3f..274271d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+Wed Jan 10 16:15:08 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * ruby.h: NORETURN macro is changed for VC++ 6.0.
+
+ * eval.c, intern.h: ditto.
+
+Wed Jan 10 13:54:53 2001 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * process.c (proc_setuid): use setresuid() if available.
+
+ * process.c (proc_setgid): use setresgid() if available.
+
+ * configure.in: ditto.
+
Wed Jan 10 01:50:45 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (rb_str_reverse_bang): forgot to call rb_str_modify().
diff --git a/configure.in b/configure.in
index 62a21fc..488615b 100644
--- a/configure.in
+++ b/configure.in
@@ -262,7 +262,8 @@ AC_REPLACE_FUNCS(dup2 memmove mkdir strcasecmp strncasecmp strerror strftime\
isinf isnan finite)
AC_CHECK_FUNCS(fmod killpg drand48 random wait4 waitpid syscall getcwd chroot\
truncate chsize times utimes fcntl lockf lstat symlink readlink\
- setitimer setruid seteuid setreuid setrgid setegid setregid pause\
+ setitimer setruid seteuid setreuid setresuid \
+ setrgid setegid setregid setresgid pause\
getpgrp setpgrp getpgid setpgid getgroups getpriority getrlimit\
dlopen sigprocmask sigaction _setjmp setsid telldir seekdir fchmod)
AC_STRUCT_TIMEZONE
diff --git a/eval.c b/eval.c
index 4ad82d1..2fc5070 100644
--- a/eval.c
+++ b/eval.c
@@ -167,7 +167,7 @@ rb_check_safe_str(x)
}
}
-static void print_undef _((VALUE, ID)) NORETURN;
+NORETURN(static void print_undef _((VALUE, ID)));
static void
print_undef(klass, id)
VALUE klass;
@@ -3312,7 +3312,7 @@ rb_iter_break()
JUMP_TAG(TAG_BREAK);
}
-static void rb_longjmp _((int, VALUE)) NORETURN;
+NORETURN(static void rb_longjmp _((int, VALUE)));
static VALUE make_backtrace _((void));
static void
@@ -5635,7 +5635,7 @@ rb_f_local_variables()
}
static VALUE rb_f_catch _((VALUE,VALUE));
-static VALUE rb_f_throw _((int,VALUE*)) NORETURN;
+NORETURN(static VALUE rb_f_throw _((int,VALUE*)));
struct end_proc_data {
void (*func)();
diff --git a/intern.h b/intern.h
index 640fb5d..e36a176 100644
--- a/intern.h
+++ b/intern.h
@@ -104,13 +104,13 @@ EXTERN int ruby_nerrs;
VALUE rb_exc_new _((VALUE, const char*, long));
VALUE rb_exc_new2 _((VALUE, const char*));
VALUE rb_exc_new3 _((VALUE, VALUE));
-void rb_loaderror __((const char*, ...)) NORETURN;
+NORETURN(void rb_loaderror __((const char*, ...)));
void rb_compile_error __((const char*, ...));
void rb_compile_error_append __((const char*, ...));
-void rb_error_frozen _((char*)) NORETURN;
+NORETURN(void rb_error_frozen _((char*)));
/* eval.c */
-void rb_exc_raise _((VALUE)) NORETURN;
-void rb_exc_fatal _((VALUE)) NORETURN;
+NORETURN(void rb_exc_raise _((VALUE)));
+NORETURN(void rb_exc_fatal _((VALUE)));
void rb_remove_method _((VALUE, const char*));
void rb_disable_super _((VALUE, const char*));
void rb_enable_super _((VALUE, const char*));
@@ -132,7 +132,7 @@ ID rb_frame_last_func _((void));
VALUE rb_obj_instance_eval _((int, VALUE*, VALUE));
void rb_load _((VALUE, int));
void rb_load_protect _((VALUE, int, int*));
-void rb_jump_tag _((int)) NORETURN;
+NORETURN(void rb_jump_tag _((int)));
int rb_provided _((const char*));
void rb_provide _((const char*));
VALUE rb_f_require _((VALUE, VALUE));
diff --git a/process.c b/process.c
index 9015397..ebc76d5 100644
--- a/process.c
+++ b/process.c
@@ -952,10 +952,11 @@ proc_setuid(obj, id)
int uid;
uid = NUM2INT(id);
-#ifdef HAVE_SETREUID
+#if defined HAVE_SETRESUID
+ setresuid(uid, -1, -1);
+#elif defined HAVE_SETREUID
setreuid(uid, -1);
-#else
-#ifdef HAVE_SETRUID
+#elif defined HAVE_SETRUID
setruid(uid);
#else
{
@@ -965,7 +966,6 @@ proc_setuid(obj, id)
rb_notimplement();
}
#endif
-#endif
return INT2FIX(uid);
}
@@ -984,11 +984,12 @@ proc_setgid(obj, id)
int gid;
gid = NUM2INT(id);
-#ifdef HAS_SETRGID
- setrgid((GIDTYPE)gid);
-#else
-#ifdef HAVE_SETREGID
+#if defined HAVE_SETRESGID
+ setresgid(gid, -1, -1);
+#elif defined HAVE_SETREGID
setregid(gid, -1);
+#elif defined HAS_SETRGID
+ setrgid((GIDTYPE)gid);
#else
{
if (getegid() == gid)
@@ -997,7 +998,6 @@ proc_setgid(obj, id)
rb_notimplement();
}
#endif
-#endif
return INT2FIX(gid);
}
@@ -1013,11 +1013,12 @@ static VALUE
proc_seteuid(obj, euid)
VALUE obj, euid;
{
-#ifdef HAVE_SETEUID
- if (seteuid(NUM2INT(euid)) < 0) rb_sys_fail(0);
-#else
-#ifdef HAVE_SETREUID
+#if defined HAVE_SETRESUID
+ if (setresuid(-1, NUM2INT(euid), -1) < 0) rb_sys_fail(0);
+#elif defined HAVE_SETREUID
if (setreuid(-1, NUM2INT(euid)) < 0) rb_sys_fail(0);
+#elif defined HAVE_SETEUID
+ if (seteuid(NUM2INT(euid)) < 0) rb_sys_fail(0);
#else
euid = NUM2INT(euid);
if (euid == getuid())
@@ -1025,7 +1026,6 @@ proc_seteuid(obj, euid)
else
rb_notimplement();
#endif
-#endif
return euid;
}
@@ -1042,11 +1042,12 @@ proc_setegid(obj, egid)
VALUE obj, egid;
{
rb_secure(2);
-#ifdef HAVE_SETEGID
- if (setegid(NUM2INT(egid)) < 0) rb_sys_fail(0);
-#else
-#ifdef HAVE_SETREGID
+#if defined HAVE_SETRESGID
+ if (setresgid(-1, NUM2INT(egid), -1) < 0) rb_sys_fail(0);
+#elif defined HAVE_SETREGID
if (setregid(-1, NUM2INT(egid)) < 0) rb_sys_fail(0);
+#elif defined HAVE_SETEGID
+ if (setegid(NUM2INT(egid)) < 0) rb_sys_fail(0);
#else
egid = NUM2INT(egid);
if (egid == getgid())
@@ -1054,7 +1055,6 @@ proc_setegid(obj, egid)
else
rb_notimplement();
#endif
-#endif
return egid;
}
diff --git a/ruby.h b/ruby.h
index 9784fc6..de2bf32 100644
--- a/ruby.h
+++ b/ruby.h
@@ -64,9 +64,9 @@ extern "C" {
#endif
#ifdef HAVE_ATTR_NORETURN
-# define NORETURN __attribute__ ((noreturn))
-#else
-# define NORETURN
+# define NORETURN(x) x __attribute__ ((noreturn))
+#elif !defined NORETURN
+# define NORETURN(x) x
#endif
#if defined(HAVE_ALLOCA_H) && !defined(__GNUC__)
@@ -453,13 +453,13 @@ VALUE rb_equal _((VALUE,VALUE));
EXTERN VALUE ruby_verbose, ruby_debug;
-void rb_raise __((VALUE, const char*, ...)) NORETURN;
-void rb_fatal __((const char*, ...)) NORETURN;
-void rb_bug __((const char*, ...)) NORETURN;
-void rb_sys_fail _((const char*)) NORETURN;
-void rb_iter_break _((void)) NORETURN;
-void rb_exit _((int)) NORETURN;
-void rb_notimplement _((void)) NORETURN;
+NORETURN(void rb_raise __((VALUE, const char*, ...)));
+NORETURN(void rb_fatal __((const char*, ...)));
+NORETURN(void rb_bug __((const char*, ...)));
+NORETURN(void rb_sys_fail _((const char*)));
+NORETURN(void rb_iter_break _((void)));
+NORETURN(void rb_exit _((int)));
+NORETURN(void rb_notimplement _((void)));
void rb_warn __((const char*, ...));
void rb_warning __((const char*, ...)); /* reports if `-w' specified */
@@ -472,7 +472,7 @@ VALUE rb_rescue _((VALUE(*)(),VALUE,VALUE(*)(),VALUE));
VALUE rb_rescue2 __((VALUE(*)(),VALUE,VALUE(*)(),VALUE,...));
VALUE rb_ensure _((VALUE(*)(),VALUE,VALUE(*)(),VALUE));
VALUE rb_catch _((const char*,VALUE(*)(),VALUE));
-void rb_throw _((const char*,VALUE)) NORETURN;
+NORETURN(void rb_throw _((const char*,VALUE)));
VALUE rb_require _((const char*));
diff --git a/win32/win32.h b/win32/win32.h
index ebffc5c..8c03f43 100644
--- a/win32/win32.h
+++ b/win32/win32.h
@@ -16,6 +16,10 @@
#define EXTERN extern __declspec(dllexport)
#endif
+#if defined _MSC_VER
+#define NORETURN(x) __declspec(noreturn) x
+#endif
+
//
// Definitions for NT port of Perl
//