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

ruby-changes:64208

From: Nobuyoshi <ko1@a...>
Date: Wed, 16 Dec 2020 17:55:09 +0900 (JST)
Subject: [ruby-changes:64208] 8b32191a31 (master): Ignore failure on unsupported fcntl to drop non-blocking mode

https://git.ruby-lang.org/ruby.git/commit/?id=8b32191a31

From 8b32191a3101cb6441fc64c87cfd011fdadc6867 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Tue, 15 Dec 2020 23:17:23 +0900
Subject: Ignore failure on unsupported fcntl to drop non-blocking mode


diff --git a/ruby.c b/ruby.c
index fc9adf7..aa6d4a2 100644
--- a/ruby.c
+++ b/ruby.c
@@ -2244,9 +2244,13 @@ open_load_file(VALUE fname_v, int *xflag) https://github.com/ruby/ruby/blob/trunk/ruby.c#L2244
 	rb_update_max_fd(fd);
 
 #if defined HAVE_FCNTL && MODE_TO_LOAD != O_RDONLY
+# ifdef ENOTSUP
+#   define IS_SUPPORTED_OP(e) ((e) != ENOTSUP)
+# else
+#   define IS_SUPPORTED_OP(e) ((void)(e), 1)
+# endif
 	/* disabling O_NONBLOCK */
-	if (fcntl(fd, F_SETFL, 0) < 0) {
-	    e = errno;
+	if (fcntl(fd, F_SETFL, 0) < 0 && IS_SUPPORTED_OP(e = errno)) {
 	    (void)close(fd);
 	    rb_load_fail(fname_v, strerror(e));
 	}
-- 
cgit v0.10.2


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

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