Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/mingw/mingwex/dirent.c')
-rw-r--r--winsup/mingw/mingwex/dirent.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/winsup/mingw/mingwex/dirent.c b/winsup/mingw/mingwex/dirent.c
index e3885f0ea..9eb1a502c 100644
--- a/winsup/mingw/mingwex/dirent.c
+++ b/winsup/mingw/mingwex/dirent.c
@@ -40,6 +40,7 @@ opendir (const char *szPath)
{
DIR *nd;
unsigned int rc;
+ char szFullPath[MAX_PATH];
errno = 0;
@@ -56,7 +57,7 @@ opendir (const char *szPath)
}
/* Attempt to determine if the given path really is a directory. */
- rc = GetFileAttributes(szPath);
+ rc = GetFileAttributes (szPath);
if (rc == -1)
{
/* call GetLastError for more error info */
@@ -70,9 +71,12 @@ opendir (const char *szPath)
return (DIR *) 0;
}
+ /* Make an absolute pathname. */
+ _fullpath (szFullPath, szPath, MAX_PATH);
+
/* Allocate enough space to store DIR structure and the complete
* directory path given. */
- nd = (DIR *) malloc (sizeof (DIR) + strlen (szPath) + strlen (SLASH) +
+ nd = (DIR *) malloc (sizeof (DIR) + strlen (szFullPath) + strlen (SLASH) +
strlen (SUFFIX));
if (!nd)
@@ -83,7 +87,7 @@ opendir (const char *szPath)
}
/* Create the search expression. */
- strcpy (nd->dd_name, szPath);
+ strcpy (nd->dd_name, szFullPath);
/* Add on a slash if the path does not end with one. */
if (nd->dd_name[0] != '\0' &&