[前][次][番号順一覧][スレッド一覧]

ruby-changes:54858

From: ko1 <ko1@a...>
Date: Wed, 13 Feb 2019 18:40:49 +0900 (JST)
Subject: [ruby-changes:54858] ko1:r67063 (trunk): check return value of `write` to suppress warning.

ko1	2019-02-13 18:40:45 +0900 (Wed, 13 Feb 2019)

  New Revision: 67063

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67063

  Log:
    check return value of `write` to suppress warning.
    
    * ext/-test-/gvl/call_without_gvl/call_without_gvl.c (do_loop):
      `-Wunused-result` compiler option (gcc?) checks checking
      return value of `write`.

  Modified files:
    trunk/ext/-test-/gvl/call_without_gvl/call_without_gvl.c
Index: ext/-test-/gvl/call_without_gvl/call_without_gvl.c
===================================================================
--- ext/-test-/gvl/call_without_gvl/call_without_gvl.c	(revision 67062)
+++ ext/-test-/gvl/call_without_gvl/call_without_gvl.c	(revision 67063)
@@ -38,7 +38,8 @@ do_loop(void *p) https://github.com/ruby/ruby/blob/trunk/ext/-test-/gvl/call_without_gvl/call_without_gvl.c#L38
     struct loop_ctl *ctl = p;
 
     /* tell the waiting process they can interrupt us, now */
-    write(ctl->notify_fd, "", 1);
+    int err = write(ctl->notify_fd, "", 1);
+    if (err == -1) rb_bug("write error");
 
     while (!ctl->stop) {
         struct timeval tv = { 0, 10000 };

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]