diff options
author | Bruno Haible <bruno@clisp.org> | 2019-05-29 02:44:52 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2019-05-31 16:56:50 +0200 |
commit | 9c383f22c6d50f4bcd7b3e3aa4611cfb61874025 (patch) | |
tree | de6171a261143768a6b962513cc3c2055606b9bf /lib/binary-io.h | |
parent | 1c0e950aa8238a6b5005ebde19ccf9cfd29afdd3 (diff) | |
download | gnulib-9c383f22c6d50f4bcd7b3e3aa4611cfb61874025.tar.gz |
binary-io: Attempted use of O_BINARY on consoles no longer fails.
Reported by KO Myung-Hun <komh78@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2019-05/msg00124.html>.
* lib/binary-io.h (__gl_setmode_check): Remove function.
(set_binary_mode): Declare as notinline on DJGPP and EMX.
* lib/binary-io.c (__gl_setmode_check): Remove function.
(set_binary_mode): Define here on DJGPP and EMX. Inline
__gl_setmode_check. In case of a tty, don't return an error code.
Diffstat (limited to 'lib/binary-io.h')
-rw-r--r-- | lib/binary-io.h | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/binary-io.h b/lib/binary-io.h index 720b08c755..8d4133b0f3 100644 --- a/lib/binary-io.h +++ b/lib/binary-io.h @@ -53,25 +53,21 @@ __gl_setmode (int fd _GL_UNUSED, int mode _GL_UNUSED) } #endif -#if defined __DJGPP__ || defined __EMX__ -extern int __gl_setmode_check (int); -#else -BINARY_IO_INLINE int -__gl_setmode_check (int fd _GL_UNUSED) { return 0; } -#endif - /* Set FD's mode to MODE, which should be either O_TEXT or O_BINARY. Return the old mode if successful, -1 (setting errno) on failure. Ordinarily this function would be called 'setmode', since that is its name on MS-Windows, but it is called 'set_binary_mode' here to avoid colliding with a BSD function of another name. */ +#if defined __DJGPP__ || defined __EMX__ +extern int set_binary_mode (int fd, int mode); +#else BINARY_IO_INLINE int set_binary_mode (int fd, int mode) { - int r = __gl_setmode_check (fd); - return r != 0 ? r : __gl_setmode (fd, mode); + return __gl_setmode (fd, mode); } +#endif /* This macro is obsolescent. */ #define SET_BINARY(fd) ((void) set_binary_mode (fd, O_BINARY)) |