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

ruby-changes:39028

From: nobu <ko1@a...>
Date: Thu, 2 Jul 2015 21:32:29 +0900 (JST)
Subject: [ruby-changes:39028] nobu:r51109 (trunk): dir.c: show warnings

nobu	2015-07-02 21:32:09 +0900 (Thu, 02 Jul 2015)

  New Revision: 51109

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

  Log:
    dir.c: show warnings
    
    * dir.c (replace_real_basename): show warnings at errors.
      [Bug #10015]

  Modified files:
    trunk/ChangeLog
    trunk/dir.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51108)
+++ ChangeLog	(revision 51109)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jul  2 21:32:06 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* dir.c (replace_real_basename): show warnings at errors.
+	  [Bug #10015]
+
 Thu Jul  2 18:39:20 2015  Koichi Sasada  <ko1@a...>
 
 	* gc.c: remove `#define RGENGC_OBJ_INFO 1' line introduced to
Index: dir.c
===================================================================
--- dir.c	(revision 51108)
+++ dir.c	(revision 51109)
@@ -1462,7 +1462,7 @@ is_case_sensitive(DIR *dirp) https://github.com/ruby/ruby/blob/trunk/dir.c#L1462
 }
 
 static char *
-replace_real_basename(char *path, long base, rb_encoding *enc, int norm_p, rb_pathtype_t *type)
+replace_real_basename(char *path, long base, rb_encoding *enc, int norm_p, int flags, rb_pathtype_t *type)
 {
     struct {
 	u_int32_t length;
@@ -1478,8 +1478,11 @@ replace_real_basename(char *path, long b https://github.com/ruby/ruby/blob/trunk/dir.c#L1478
     IF_NORMALIZE_UTF8PATH(VALUE utf8str = Qnil);
 
     *type = path_noent;
-    if (getattrlist(path, &al, attrbuf, sizeof(attrbuf), FSOPT_NOFOLLOW))
+    if (getattrlist(path, &al, attrbuf, sizeof(attrbuf), FSOPT_NOFOLLOW)) {
+	if (!to_be_ignored(errno))
+	    sys_warning(path, enc);
 	return path;
+    }
 
     switch (attrbuf[0].objtype) {
       case VREG: *type = path_regular; break;
@@ -1513,7 +1516,7 @@ replace_real_basename(char *path, long b https://github.com/ruby/ruby/blob/trunk/dir.c#L1516
 VALUE rb_w32_conv_from_wchar(const WCHAR *wstr, rb_encoding *enc);
 
 static char *
-replace_real_basename(char *path, long base, rb_encoding *enc, int norm_p, rb_pathtype_t *type)
+replace_real_basename(char *path, long base, rb_encoding *enc, int norm_p, int flags, rb_pathtype_t *type)
 {
     char *plainname = path;
     volatile VALUE tmp = 0;
@@ -1538,6 +1541,8 @@ replace_real_basename(char *path, long b https://github.com/ruby/ruby/blob/trunk/dir.c#L1541
     free(wplain);
     if (h == INVALID_HANDLE_VALUE) {
 	*type = path_noent;
+	if (!to_be_ignored(errno))
+	    sys_warning(path, enc);
 	return path;
     }
     FindClose(h);
@@ -1883,7 +1888,7 @@ glob_helper( https://github.com/ruby/ruby/blob/trunk/dir.c#L1888
 		if ((*cur)->type == ALPHA) {
 		    long base = pathlen + (dirsep != 0);
 		    buf = replace_real_basename(buf, base, enc, IF_NORMALIZE_UTF8PATH(1)+0,
-						&new_pathtype);
+						flags, &new_pathtype);
 		}
 #endif
 		status = glob_helper(buf, 1, new_pathtype, new_beg,

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

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