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 'newlib/libc/posix/opendir.c')
-rw-r--r--newlib/libc/posix/opendir.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/newlib/libc/posix/opendir.c b/newlib/libc/posix/opendir.c
index de14edcad..ce59cf4c8 100644
--- a/newlib/libc/posix/opendir.c
+++ b/newlib/libc/posix/opendir.c
@@ -52,10 +52,14 @@ opendir(name)
{
register DIR *dirp;
register int fd;
+ int rc = 0;
if ((fd = open(name, 0)) == -1)
return NULL;
- if (fcntl(fd, F_SETFD, 1) == -1 ||
+#ifdef HAVE_FCNTL
+ rc = fcntl(fd, F_SETFD, 1);
+#endif
+ if (rc == -1 ||
(dirp = (DIR *)malloc(sizeof(DIR))) == NULL) {
close (fd);
return NULL;