diff options
Diffstat (limited to 'newlib/libc/posix')
-rw-r--r-- | newlib/libc/posix/opendir.c | 6 |
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; |