summaryrefslogtreecommitdiffstats
path: root/winsup/mingw/mingwex/dirent.c
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/mingw/mingwex/dirent.c')
-rw-r--r--winsup/mingw/mingwex/dirent.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/winsup/mingw/mingwex/dirent.c b/winsup/mingw/mingwex/dirent.c
index cdca6de35..20d1921d7 100644
--- a/winsup/mingw/mingwex/dirent.c
+++ b/winsup/mingw/mingwex/dirent.c
@@ -113,7 +113,7 @@ _topendir (const _TCHAR *szPath)
nd->dd_dir.d_ino = 0;
nd->dd_dir.d_reclen = 0;
nd->dd_dir.d_namlen = 0;
- nd->dd_dir.d_name = nd->dd_dta.name;
+ memset (nd->dd_dir.d_name, 0, FILENAME_MAX);
return nd;
}
@@ -137,13 +137,6 @@ _treaddir (_TDIR * dirp)
return (struct _tdirent *) 0;
}
- if (dirp->dd_dir.d_name != dirp->dd_dta.name)
- {
- /* The structure does not seem to be set up correctly. */
- errno = EINVAL;
- return (struct _tdirent *) 0;
- }
-
if (dirp->dd_stat < 0)
{
/* We have already returned all files in the directory
@@ -190,7 +183,8 @@ _treaddir (_TDIR * dirp)
/* Successfully got an entry. Everything about the file is
* already appropriately filled in except the length of the
* file name. */
- dirp->dd_dir.d_namlen = _tcslen (dirp->dd_dir.d_name);
+ dirp->dd_dir.d_namlen = _tcslen (dirp->dd_dta.name);
+ _tcscpy (dirp->dd_dir.d_name, dirp->dd_dta.name);
return &dirp->dd_dir;
}