Commit f63b8cc0 authored by Barry Warsaw's avatar Barry Warsaw

posix_listdir(): When an error occurs, call

posix_error_with_filename() instead of posix_error(), passing in the
name argument, so you get information on which directory was being
listed.
parent f1882422
...@@ -773,7 +773,7 @@ posix_listdir(self, args) ...@@ -773,7 +773,7 @@ posix_listdir(self, args)
errno = GetLastError(); errno = GetLastError();
if (errno == ERROR_FILE_NOT_FOUND) if (errno == ERROR_FILE_NOT_FOUND)
return PyList_New(0); return PyList_New(0);
return posix_error(); return posix_error_with_filename(name);
} }
do { do {
if (FileData.cFileName[0] == '.' && if (FileData.cFileName[0] == '.' &&
...@@ -798,7 +798,7 @@ posix_listdir(self, args) ...@@ -798,7 +798,7 @@ posix_listdir(self, args)
if (FindClose(hFindFile) == FALSE) { if (FindClose(hFindFile) == FALSE) {
errno = GetLastError(); errno = GetLastError();
return posix_error(); return posix_error_with_filename(&name);
} }
return d; return d;
...@@ -836,7 +836,7 @@ posix_listdir(self, args) ...@@ -836,7 +836,7 @@ posix_listdir(self, args)
_A_HIDDEN | _A_SYSTEM | _A_SUBDIR, &ep) != 0) _A_HIDDEN | _A_SYSTEM | _A_SUBDIR, &ep) != 0)
{ {
errno = ENOENT; errno = ENOENT;
return posix_error(); return posix_error_with_filename(name);
} }
do { do {
if (ep.name[0] == '.' && if (ep.name[0] == '.' &&
...@@ -906,7 +906,7 @@ posix_listdir(self, args) ...@@ -906,7 +906,7 @@ posix_listdir(self, args)
if (rc != NO_ERROR) { if (rc != NO_ERROR) {
errno = ENOENT; errno = ENOENT;
return posix_error(); return posix_error_with_filename(name);
} }
if (srchcnt > 0) { /* If Directory is NOT Totally Empty, */ if (srchcnt > 0) { /* If Directory is NOT Totally Empty, */
...@@ -948,7 +948,7 @@ posix_listdir(self, args) ...@@ -948,7 +948,7 @@ posix_listdir(self, args)
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
if ((dirp = opendir(name)) == NULL) { if ((dirp = opendir(name)) == NULL) {
Py_BLOCK_THREADS Py_BLOCK_THREADS
return posix_error(); return posix_error_with_filename(name);
} }
if ((d = PyList_New(0)) == NULL) { if ((d = PyList_New(0)) == NULL) {
closedir(dirp); closedir(dirp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment