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

ruby-changes:62905

From: Masaki <ko1@a...>
Date: Sat, 12 Sep 2020 16:30:36 +0900 (JST)
Subject: [ruby-changes:62905] 0ac185be40 (master): Fix compile-time check for copy_file_range(2)

https://git.ruby-lang.org/ruby.git/commit/?id=0ac185be40

From 0ac185be403e361da31901be4d58710000367330 Mon Sep 17 00:00:00 2001
From: Masaki Matsushita <glass.saga@g...>
Date: Sat, 12 Sep 2020 16:27:14 +0900
Subject: Fix compile-time check for copy_file_range(2)

* close fds properly
* define USE_COPY_FILE_RANGE if HAVE_COPY_FILE_RANGE is defined
* avoid errors on cross-compiling environments

diff --git a/configure.ac b/configure.ac
index 6a58a80..ab5d532 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2418,6 +2418,8 @@ main() https://github.com/ruby/ruby/blob/trunk/configure.ac#L2418
    fd_in = open("/tmp", O_TMPFILE|O_RDWR, S_IRUSR);
    fd_out = open("/tmp", O_TMPFILE|O_WRONLY, S_IWUSR);
    ret = syscall(__NR_copy_file_range, fd_in, NULL, fd_out, NULL, 0, 0);
+   close(fd_in);
+   close(fd_out);
    if (ret == -1) { return 1; }
    return 0;
 #else
@@ -2426,10 +2428,11 @@ main() https://github.com/ruby/ruby/blob/trunk/configure.ac#L2428
 }
   ],
     [rb_cv_use_copy_file_range=yes],
+    [rb_cv_use_copy_file_range=no],
     [rb_cv_use_copy_file_range=no])])
-  AS_IF([test "$rb_cv_use_copy_file_range" = yes], [
-    AC_DEFINE(USE_COPY_FILE_RANGE)
-  ])
+])
+AS_CASE(["$ac_cv_func_copy_file_range:$rb_cv_use_copy_file_range"], [*yes*], [
+  AC_DEFINE(USE_COPY_FILE_RANGE)
 ])
 
 AS_CASE(["$ac_cv_func_gettimeofday:$ac_cv_func_clock_gettime"],
-- 
cgit v0.10.2


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

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