summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-30 23:03:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-30 23:03:23 +0000
commit8ad06e2604f9563f21e0b7e107aedde82f40adf8 (patch)
treec52f0d5c333e66367c9793930b5d27c850b91436 /error.c
parentfa4514e4fedc1e1390200e3901e2add22a4a27b4 (diff)
* error.c, thread_pthread.c (WRITE_CONST): suppress warnings
`ignoring return value'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r--error.c12
1 files changed, 7 insertions, 5 deletions
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();