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

ruby-changes:33534

From: nobu <ko1@a...>
Date: Fri, 18 Apr 2014 08:50:25 +0900 (JST)
Subject: [ruby-changes:33534] nobu:r45615 (trunk): configure.in: rb_cv_getcwd_malloc

nobu	2014-04-18 08:50:20 +0900 (Fri, 18 Apr 2014)

  New Revision: 45615

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45615

  Log:
    configure.in: rb_cv_getcwd_malloc
    
    * configure.in (rb_cv_getcwd_malloc): check if getcwd allocates
      buffer if NULL is given [ruby-core:62072] [Bug #9752]

  Modified files:
    trunk/ChangeLog
    trunk/configure.in
Index: configure.in
===================================================================
--- configure.in	(revision 45614)
+++ configure.in	(revision 45615)
@@ -2008,6 +2008,37 @@ AC_CHECK_FUNCS(utimes) https://github.com/ruby/ruby/blob/trunk/configure.in#L2008
 AC_CHECK_FUNCS(wait4)
 AC_CHECK_FUNCS(waitpid)
 
+AS_IF([test "$ac_cv_func_getcwd" = yes], [
+    AC_CACHE_CHECK(if getcwd allocates buffer if NULL is given, [rb_cv_getcwd_malloc],
+	[AC_TRY_RUN([
+@%:@include <stddef.h>
+@%:@include <stdio.h>
+@%:@ifdef HAVE_UNISTD_H
+@%:@include <unistd.h>
+@%:@endif
+@%:@ifndef EXIT_SUCCESS
+@%:@define EXIT_SUCCESS 0
+@%:@endif
+@%:@ifndef EXIT_FAILURE
+@%:@define EXIT_FAILURE 1
+@%:@endif
+
+int
+main(int argc, char **argv)
+{
+    if (!getcwd(NULL, 0)) return EXIT_FAILURE;
+    return EXIT_SUCCESS;
+}
+],
+	    rb_cv_getcwd_malloc=yes,
+	    rb_cv_getcwd_malloc=no,
+	    AS_CASE($target_os,
+		[linux*|darwin*|*bsd|cygwin*|mingw*|mswin*],
+		[rb_cv_getcwd_malloc=yes],
+		[rb_cv_getcwd_malloc=no]))])
+    AS_IF([test "$rb_cv_getcwd_malloc" = no], [AC_DEFINE(NO_GETCWD_MALLOC, 1)])
+])
+
 AC_DEFUN([RUBY_CHECK_BUILTIN_FUNC], [dnl
 AC_CACHE_CHECK([for $1], AS_TR_SH(rb_cv_builtin_$1),
   [AC_LINK_IFELSE(
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45614)
+++ ChangeLog	(revision 45615)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Apr 18 08:50:18 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* configure.in (rb_cv_getcwd_malloc): check if getcwd allocates
+	  buffer if NULL is given [ruby-core:62072] [Bug #9752]
+
 Thu Apr 17 16:28:10 2014  SHIBATA Hiroshi  <shibata.hiroshi@g...>
 
 	* prelude.rb: [DOC] Update Thread::exclusive docs by @stevenharman.

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

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