Commit f97d76ac authored by unknown's avatar unknown
Browse files

Bug#18474 Unlistable directories yield no info from information_schema, part2

 - Make the windows implementation of 'my_dir' behave like the default implementation


mysys/my_lib.c:
  If 'findfirst' returns EINVAL, just continue and return 0 files to read in this dir.
parent e1da710d
Loading
Loading
Loading
Loading
+17 −9
Original line number Diff line number Diff line
@@ -398,14 +398,6 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
  tmp_file[2]='*';
  tmp_file[3]='\0';

#ifdef __BORLANDC__
  if ((handle= findfirst(tmp_path,&find,0)) == -1L)
    goto error;
#else
  if ((handle=_findfirst(tmp_path,&find)) == -1L)
    goto error;
#endif

  if (!(buffer= my_malloc(ALIGN_SIZE(sizeof(MY_DIR)) + 
                          ALIGN_SIZE(sizeof(DYNAMIC_ARRAY)) +
                          sizeof(MEM_ROOT), MyFlags)))
@@ -426,6 +418,22 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
  /* MY_DIR structure is allocated and completly initialized at this point */
  result= (MY_DIR*)buffer;

#ifdef __BORLANDC__
  if ((handle= findfirst(tmp_path,&find,0)) == -1L)
#else
  if ((handle=_findfirst(tmp_path,&find)) == -1L)
#endif
  {
    DBUG_PRINT("info", ("find_first returned error"));
    if  (errno != EINVAL)
      goto error;
    /*
      Could not read the directory, no read access.
      Probably because by "chmod -r".
      continue and return zero files in dir
    */
  }

  do
  {
#ifdef __BORLANDC__