summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--error.c12
-rw-r--r--thread_pthread.c2
3 files changed, 14 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index acd13d9ab7..428d414ff9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Jul 1 08:03:15 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c, thread_pthread.c (WRITE_CONST): suppress warnings
+ `ignoring return value'.
+
Fri Jul 1 06:41:36 2011 Koichi Sasada <ko1@atdot.net>
* thread.c (rb_threadptr_check_signal): only wake up main thread.
@@ -9,7 +14,7 @@ Fri Jul 1 06:41:36 2011 Koichi Sasada <ko1@atdot.net>
* bootstraptest/test_fork.rb: add a test for above.
* signal.c (rb_get_next_signal): skip if signal_buff is empty.
- (check signal_buff.size first)
+ (check signal_buff.size first)
* vm_core.h: remove unused variable rb_thread_t::exec_signal.
diff --git a/error.c b/error.c
index aa87c29833..5bceb7df5b 100644
--- a/error.c
+++ b/error.c
@@ -295,12 +295,14 @@ rb_bug_errno(const char *mesg, int errno_arg)
* this is safe to call inside signal handler and timer thread
* (which isn't a Ruby Thread object)
*/
-#define WRITE_CONST(fd,str) write((fd),(str),sizeof(str) - 1)
+#define write_or_abort(fd, str, len) (write((fd), (str), (len)) < 0 ? abort() : (void)0)
+#define WRITE_CONST(fd,str) write_or_abort((fd),(str),sizeof(str) - 1)
-void rb_async_bug_errno(const char *mesg, int errno_arg)
+void
+rb_async_bug_errno(const char *mesg, int errno_arg)
{
WRITE_CONST(2, "[ASYNC BUG] ");
- write(2, mesg, strlen(mesg));
+ write_or_abort(2, mesg, strlen(mesg));
WRITE_CONST(2, "\n");
if (errno_arg == 0) {
@@ -311,10 +313,10 @@ void rb_async_bug_errno(const char *mesg, int errno_arg)
if (!errno_str)
errno_str = "undefined errno";
- write(2, errno_str, strlen(errno_str));
+ write_or_abort(2, errno_str, strlen(errno_str));
}
WRITE_CONST(2, "\n\n");
- write(2, ruby_description, strlen(ruby_description));
+ write_or_abort(2, ruby_description, strlen(ruby_description));
WRITE_CONST(2, "\n\n");
WRITE_CONST(2, REPORTBUG_MSG);
abort();
diff --git a/thread_pthread.c b/thread_pthread.c
index 4f66c4e2cf..bd481ddc70 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -994,7 +994,7 @@ static int timer_thread_pipe_owner_process;
#define TT_DEBUG 0
-#define WRITE_CONST(fd, str) write((fd),(str),sizeof(str)-1);
+#define WRITE_CONST(fd, str) (void)(write((fd),(str),sizeof(str)-1)<0)
/* only use signal-safe system calls here */
void