diff options
author | Danny Smith <dannysmith@users.sourceforge.net> | 2002-04-18 10:35:41 +0000 |
---|---|---|
committer | Danny Smith <dannysmith@users.sourceforge.net> | 2002-04-18 10:35:41 +0000 |
commit | 10e835062da5f477ad46645c596cd8541f41db11 (patch) | |
tree | 4adfb21722e801feb4bb6d3f3ff664968f763656 /winsup | |
parent | 9ac413123daf6e8aea056d62c5069b90f10a26fd (diff) | |
download | newlib-10e835062da5f477ad46645c596cd8541f41db11.zip newlib-10e835062da5f477ad46645c596cd8541f41db11.tar.gz newlib-10e835062da5f477ad46645c596cd8541f41db11.tar.bz2 |
* mingwex/dirent.c (opendir): Convert given pathname to
absolute pathname.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/mingw/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/mingw/mingwex/dirent.c | 10 |
2 files changed, 12 insertions, 3 deletions
diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index 8d1fdb0..c27951c 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,8 @@ +2002-04-18 Pascal Obry <obry@gnat.com> + + * mingwex/dirent.c (opendir): Convert given pathname to + absolute pathname. + 2002-04-17 Danny Smith <dannysmith@users.sourceforge.net> * Makefile.in (INCLUDES): Add "-iwithprefixbefore include" to diff --git a/winsup/mingw/mingwex/dirent.c b/winsup/mingw/mingwex/dirent.c index e3885f0..9eb1a50 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' && |