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:
-rw-r--r--newlib/libc/posix/opendir.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/newlib/libc/posix/opendir.c b/newlib/libc/posix/opendir.c
index 1416f1053..650cbfe8d 100644
--- a/newlib/libc/posix/opendir.c
+++ b/newlib/libc/posix/opendir.c
@@ -49,17 +49,12 @@ static char sccsid[] = "@(#)opendir.c 5.11 (Berkeley) 2/23/91";
DIR *
opendir (const char *name)
{
- register DIR *dirp;
- register int fd;
- int rc = 0;
+ DIR *dirp;
+ int fd;
- if ((fd = open(name, 0)) == -1)
+ if ((fd = open(name, O_RDONLY | O_DIRECTORY | O_CLOEXEC)) == -1)
return NULL;
-#ifdef HAVE_FCNTL
- rc = fcntl(fd, F_SETFD, 1);
-#endif
- if (rc == -1 ||
- (dirp = (DIR *)malloc(sizeof(DIR))) == NULL) {
+ if ((dirp = (DIR *)malloc(sizeof(DIR))) == NULL) {
close (fd);
return NULL;
}