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:
authorCorinna Vinschen <corinna@vinschen.de>2005-03-01 14:51:29 +0300
committerCorinna Vinschen <corinna@vinschen.de>2005-03-01 14:51:29 +0300
commit4717214c201b6d54b7c58d1fedf6e88c5336f55c (patch)
treea744789ae843e8d73f7a0c2f78ba8862bca80104 /winsup/cygwin/scandir.cc
parent93c60b6d6a34653d966a90f2bdb4fd6e28ed0a76 (diff)
* fhandler_clipboard.cc (fhandler_dev_clipboard::write): Never set
errno to 0. (fhandler_dev_clipboard::read): Ditto. * fhandler_windows.cc (fhandler_windows::read): Ditto. * scandir.cc (scandir): Ditto. * syscalls.cc (_fstat64_r): Ditto. (_fstat_r): Ditto. (_stat64_r): Ditto. (_stat_r): Ditto. * mmap.cc (mmap64): Fix /dev/zero mapping.
Diffstat (limited to 'winsup/cygwin/scandir.cc')
-rw-r--r--winsup/cygwin/scandir.cc16
1 files changed, 5 insertions, 11 deletions
diff --git a/winsup/cygwin/scandir.cc b/winsup/cygwin/scandir.cc
index a2f682a50..84b6538a4 100644
--- a/winsup/cygwin/scandir.cc
+++ b/winsup/cygwin/scandir.cc
@@ -31,12 +31,11 @@ scandir (const char *dir,
struct dirent *ent, *etmp, **nl = NULL, **ntmp;
int count = 0;
int allocated = 0;
+ int err = 0;
if (!(dirp = opendir (dir)))
return -1;
- int prior_errno = get_errno ();
- set_errno (0);
if (!compar)
compar = alphasort;
@@ -44,10 +43,6 @@ scandir (const char *dir,
{
if (!select || select (ent))
{
-
- /* Ignore error from readdir/select. See POSIX specs. */
- set_errno (0);
-
if (count == allocated)
{
@@ -59,7 +54,7 @@ scandir (const char *dir,
ntmp = (struct dirent **) realloc (nl, allocated * sizeof *nl);
if (!ntmp)
{
- set_errno (ENOMEM);
+ err = ENOMEM;
break;
}
nl = ntmp;
@@ -67,7 +62,7 @@ scandir (const char *dir,
if (!(etmp = (struct dirent *) malloc (sizeof *ent)))
{
- set_errno (ENOMEM);
+ err = ENOMEM;
break;
}
*etmp = *ent;
@@ -75,7 +70,7 @@ scandir (const char *dir,
}
}
- if ((prior_errno = get_errno ()) != 0)
+ if (err != 0)
{
closedir (dirp);
if (nl)
@@ -85,12 +80,11 @@ scandir (const char *dir,
free (nl);
}
/* Ignore errors from closedir() and what not else. */
- set_errno (prior_errno);
+ set_errno (err);
return -1;
}
closedir (dirp);
- set_errno (prior_errno);
qsort (nl, count, sizeof *nl, (int (*)(const void *, const void *)) compar);
if (namelist)