From 5f0704b66cea73cf2ab148ec4cff645cc301fd8c Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Thu, 31 Aug 2017 14:07:23 +0200 Subject: libio: Assume _LIBC, weak_alias, errno, (__set_)errno &c are defined Do not define _POSIX_SOURCE. --- libio/iofdopen.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'libio/iofdopen.c') diff --git a/libio/iofdopen.c b/libio/iofdopen.c index 2a1df46..90346a4 100644 --- a/libio/iofdopen.c +++ b/libio/iofdopen.c @@ -28,17 +28,7 @@ #include "libioP.h" #include -#ifdef _LIBC -# include -#endif - -#ifndef _IO_fcntl -#ifdef _LIBC -#define _IO_fcntl __fcntl -#else -#define _IO_fcntl fcntl -#endif -#endif +#include _IO_FILE * _IO_new_fdopen (int fd, const char *mode) @@ -95,11 +85,7 @@ _IO_new_fdopen (int fd, const char *mode) } break; } -#ifdef F_GETFL - int fd_flags = _IO_fcntl (fd, F_GETFL); -#ifndef O_ACCMODE -#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) -#endif + int fd_flags = __fcntl (fd, F_GETFL); if (fd_flags == -1) return NULL; @@ -129,12 +115,9 @@ _IO_new_fdopen (int fd, const char *mode) if ((read_write & _IO_IS_APPENDING) && !(fd_flags & O_APPEND)) { do_seek = true; -#ifdef F_SETFL - if (_IO_fcntl (fd, F_SETFL, fd_flags | O_APPEND) == -1) -#endif + if (__fcntl (fd, F_SETFL, fd_flags | O_APPEND) == -1) return NULL; } -#endif new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE)); if (new_f == NULL) -- cgit v1.1