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

ruby-changes:41615

From: nobu <ko1@a...>
Date: Fri, 29 Jan 2016 17:40:15 +0900 (JST)
Subject: [ruby-changes:41615] nobu:r53689 (trunk): win32/file.c: drop garbage

nobu	2016-01-29 17:41:10 +0900 (Fri, 29 Jan 2016)

  New Revision: 53689

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53689

  Log:
    win32/file.c: drop garbage
    
    * win32/file.c (rb_readlink): drop garbage after the substitute
      name, as rb_w32_read_reparse_point returns the expected buffer
      size but "\??\" prefix is dropped from the result.
    * win32/win32.c (w32_readlink): ditto, including NUL-terminator.

  Modified files:
    trunk/ChangeLog
    trunk/win32/file.c
    trunk/win32/win32.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 53688)
+++ ChangeLog	(revision 53689)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Jan 29 17:40:07 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* win32/file.c (rb_readlink): drop garbage after the substitute
+	  name, as rb_w32_read_reparse_point returns the expected buffer
+	  size but "\??\" prefix is dropped from the result.
+
+	* win32/win32.c (w32_readlink): ditto, including NUL-terminator.
+
 Fri Jan 29 17:07:27 2016  NAKAMURA Usaku  <usa@r...>
 
 	* win32/win32.c (fileattr_to_unixmode, rb_w32_reparse_symlink_p): volume
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 53688)
+++ win32/win32.c	(revision 53689)
@@ -4888,6 +4888,7 @@ w32_readlink(UINT cp, const char *path, https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L4888
 	errno = map_errno(e);
 	return -1;
     }
+    len = lstrlenW(wname) + 1;
     ret = WideCharToMultiByte(cp, 0, wname, len, buf, bufsize, NULL, NULL);
     ALLOCV_END(wtmp);
     if (e) {
Index: win32/file.c
===================================================================
--- win32/file.c	(revision 53688)
+++ win32/file.c	(revision 53689)
@@ -697,6 +697,7 @@ rb_readlink(VALUE path, rb_encoding *res https://github.com/ruby/ruby/blob/trunk/win32/file.c#L697
     enc = resultenc;
     cp = path_cp = code_page(enc);
     if (cp == INVALID_CODE_PAGE) cp = CP_UTF8;
+    len = lstrlenW(wbuf);
     str = append_wstr(rb_enc_str_new(0, 0, enc), wbuf, len, cp, path_cp, enc);
     ALLOCV_END(wtmp);
     return str;

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

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