summaryrefslogtreecommitdiffstats
path: root/newlib/libc/syscalls/sysfcntl.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/syscalls/sysfcntl.c')
-rw-r--r--newlib/libc/syscalls/sysfcntl.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/newlib/libc/syscalls/sysfcntl.c b/newlib/libc/syscalls/sysfcntl.c
index 23e1d837a..4d1c57cc1 100644
--- a/newlib/libc/syscalls/sysfcntl.c
+++ b/newlib/libc/syscalls/sysfcntl.c
@@ -2,6 +2,7 @@
/* only called from stdio/fdopen.c, so arg can be int. */
#include <reent.h>
+#include <errno.h>
int
fcntl (fd, flag, arg)
@@ -9,9 +10,14 @@ fcntl (fd, flag, arg)
int flag;
int arg;
{
-#ifdef REENTRANT_SYSCALLS_PROVIDED
+#ifdef HAVE_FCNTL
+# ifdef REENTRANT_SYSCALLS_PROVIDED
return _fcntl_r (_REENT, fd, flag, arg);
-#else
+# else
return _fcntl (fd, flag, arg);
-#endif
+# endif
+#else /* !HAVE_FCNTL */
+ errno = ENOSYS;
+ return -1;
+#endif /& !HAVE_FCNTL */
}