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

ruby-changes:33209

From: nobu <ko1@a...>
Date: Sat, 8 Mar 2014 13:08:55 +0900 (JST)
Subject: [ruby-changes:33209] nobu:r45288 (trunk): process.c: GETPW_R_SIZE_INIT, GETGR_R_SIZE_INIT

nobu	2014-03-08 13:08:46 +0900 (Sat, 08 Mar 2014)

  New Revision: 45288

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

  Log:
    process.c: GETPW_R_SIZE_INIT, GETGR_R_SIZE_INIT
    
    * process.c (GETPW_R_SIZE_INIT, GETGR_R_SIZE_INIT): sysconf values
      are not maximum sizes, but initial sizes.

  Modified files:
    trunk/process.c
Index: process.c
===================================================================
--- process.c	(revision 45287)
+++ process.c	(revision 45288)
@@ -151,6 +151,8 @@ static void check_gid_switch(void); https://github.com/ruby/ruby/blob/trunk/process.c#L151
 #if defined(HAVE_PWD_H)
 # if defined(HAVE_GETPWNAM_R) && defined(_SC_GETPW_R_SIZE_MAX)
 #  define USE_GETPWNAM_R 1
+#  define GETPW_R_SIZE_INIT sysconf(_SC_GETPW_R_SIZE_MAX)
+#  define GETPW_R_SIZE_DEFAULT 0x1000
 # endif
 # ifdef USE_GETPWNAM_R
 #   define PREPARE_GETPWNAM \
@@ -188,6 +190,8 @@ static rb_uid_t obj2uid(VALUE id); https://github.com/ruby/ruby/blob/trunk/process.c#L190
 #if defined(HAVE_GRP_H)
 # if defined(HAVE_GETGRNAM_R) && defined(_SC_GETGR_R_SIZE_MAX)
 #  define USE_GETGRNAM_R
+#  define GETGR_R_SIZE_INIT sysconf(_SC_GETGR_R_SIZE_MAX)
+#  define GETGR_R_SIZE_DEFAULT 0x1000
 # endif
 # ifdef USE_GETGRNAM_R
 #   define PREPARE_GETGRNAM \
@@ -4729,8 +4733,8 @@ obj2uid(VALUE id https://github.com/ruby/ruby/blob/trunk/process.c#L4733
 	char *getpw_buf;
 	long getpw_buf_len;
 	if (!*getpw_tmp) {
-	    getpw_buf_len = sysconf(_SC_GETPW_R_SIZE_MAX);
-	    if (getpw_buf_len < 0) getpw_buf_len = 4096;
+	    getpw_buf_len = GETPW_R_SIZE_INIT;
+	    if (getpw_buf_len < 0) getpw_buf_len = GETPW_R_SIZE_DEFAULT;
 	    getpw_buf = rb_alloc_tmp_buffer(getpw_tmp, getpw_buf_len);
 	}
 	else {
@@ -4797,8 +4801,8 @@ obj2gid(VALUE id https://github.com/ruby/ruby/blob/trunk/process.c#L4801
 	char *getgr_buf;
 	long getgr_buf_len;
 	if (!*getgr_tmp) {
-	    getgr_buf_len = sysconf(_SC_GETGR_R_SIZE_MAX);
-	    if (getgr_buf_len < 0) getgr_buf_len = 4096;
+	    getgr_buf_len = GETGR_R_SIZE_INIT;
+	    if (getgr_buf_len < 0) getgr_buf_len = GETGR_R_SIZE_DEFAULT;
 	    getgr_buf = rb_alloc_tmp_buffer(getgr_tmp, getgr_buf_len);
 	}
 	else {

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

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