diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2002-09-19 21:28:52 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2002-09-19 21:28:52 +0000 |
commit | 50558bf3bdb5e2fc2454f38316af1f06f82f9a5d (patch) | |
tree | 06876f77aa28773abc0dfae1f21adf94fa5f3d26 /newlib/libc/posix/opendir.c | |
parent | 0688e43db7cdf256bd7f38c9b0524cf71032ecf9 (diff) | |
download | cygnal-50558bf3bdb5e2fc2454f38316af1f06f82f9a5d.tar.gz cygnal-50558bf3bdb5e2fc2454f38316af1f06f82f9a5d.tar.bz2 cygnal-50558bf3bdb5e2fc2454f38316af1f06f82f9a5d.zip |
2002-09-19 Jeff Johnston <jjohnstn@redhat.com>
* libc/posix/opendir.c (opendir): Change code to check
for HAVE_FCNTL before calling fcntl.
* libc/search/hash.c (hash_open): Ditto.
* libc/search/hash_page.c (open_tmp): Ditto.
* libc/reent/Makefile.am: Add fcntlr.c.
* libc/reent/Makefile.in: Regenerated.
* libc/reent/fcntlr.c: New file.
* libc/stdio/fdopen.c (_fdopen_r): Change to call _fcntl_r
instead of _fcntl when HAVE_FCNTL flag is set.
* libc/syscalls/sysfcntl.c (fcntl): Check for HAVE_FCNTL flag
to see if _fcntl or _fcntl_r should be called. If flag is not
set, default to ENOSYS stub.
Diffstat (limited to 'newlib/libc/posix/opendir.c')
-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; |