aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorMasaki Matsushita <glass.saga@gmail.com>2020-09-12 16:27:14 +0900
committerMasaki Matsushita <glass.saga@gmail.com>2020-09-12 16:27:14 +0900
commit0ac185be403e361da31901be4d58710000367330 (patch)
tree9dd5059d2a1f2c9f4dac4134d2bfcc35d3b1405b /configure.ac
parent012785ef352d6eee983e087adad71692b3aeb354 (diff)
downloadruby-0ac185be403e361da31901be4d58710000367330.tar.gz
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
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac9
1 files changed, 6 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 6a58a80b2c..ab5d532c10 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2418,6 +2418,8 @@ main()
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()
}
],
[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"],