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

ruby-changes:33210

From: nobu <ko1@a...>
Date: Sat, 8 Mar 2014 13:30:35 +0900 (JST)
Subject: [ruby-changes:33210] nobu:r45289 (trunk): process.c: need capacity

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

  New Revision: 45289

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

  Log:
    process.c: need capacity
    
    * process.c (obj2uid, obj2gid): need capacity as buffer size, not
      length.

  Modified files:
    trunk/process.c
Index: process.c
===================================================================
--- process.c	(revision 45288)
+++ process.c	(revision 45289)
@@ -4738,7 +4738,8 @@ obj2uid(VALUE id https://github.com/ruby/ruby/blob/trunk/process.c#L4738
 	    getpw_buf = rb_alloc_tmp_buffer(getpw_tmp, getpw_buf_len);
 	}
 	else {
-	    RSTRING_GETMEM(*getpw_tmp, getpw_buf, getpw_buf_len);
+	    getpw_buf = RSTRING_PTR(*getpw_tmp);
+	    getpw_buf_len = rb_str_capacity(*getpw_tmp);
 	}
 	if (getpwnam_r(usrname, &pwbuf, getpw_buf, getpw_buf_len, &pwptr))
 	    rb_sys_fail("getpwnam_r");
@@ -4806,7 +4807,8 @@ obj2gid(VALUE id https://github.com/ruby/ruby/blob/trunk/process.c#L4807
 	    getgr_buf = rb_alloc_tmp_buffer(getgr_tmp, getgr_buf_len);
 	}
 	else {
-	    RSTRING_GETMEM(*getgr_tmp, getgr_buf, getgr_buf_len);
+	    getgr_buf = RSTRING_PTR(*getgr_tmp);
+	    getgr_buf_len = rb_str_capacity(*getgr_tmp);
 	}
 	if (getgrnam_r(grpname, &grbuf, getgr_buf, getgr_buf_len, &grptr))
 	    rb_sys_fail("getgrnam_r");

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

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