mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-07 06:43:00 +03:00
io: replace local_isatty() with a proper function __isatty_nostatus()
Replace local_isatty() inlined in libio with a proper function __isatty_nostatus(). This allows simpler system-specific implementations that don't need to touch errno at all. Note: I left the prototype in include/unistd.h (the internal header file.) It didn't much make sense to me to put it in a different header (not-cancel.h), but perhaps someone can elucidate the need. Add such an implementation for Linux, with a generic fallback. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
committed by
Adhemerval Zanella
parent
edf7328db2
commit
c4929eecf7
@@ -61,16 +61,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* Return the result of isatty, without changing errno. */
|
||||
static int
|
||||
local_isatty (int fd)
|
||||
{
|
||||
int save_errno = errno;
|
||||
int res = __isatty (fd);
|
||||
__set_errno (save_errno);
|
||||
return res;
|
||||
}
|
||||
|
||||
/* Allocate a file buffer, or switch to unbuffered I/O. Streams for
|
||||
TTY devices default to line buffered. */
|
||||
int
|
||||
@@ -90,7 +80,7 @@ _IO_file_doallocate (FILE *fp)
|
||||
#ifdef DEV_TTY_P
|
||||
DEV_TTY_P (&st) ||
|
||||
#endif
|
||||
local_isatty (fp->_fileno))
|
||||
__isatty_nostatus (fp->_fileno))
|
||||
fp->_flags |= _IO_LINE_BUF;
|
||||
}
|
||||
#if defined _STATBUF_ST_BLKSIZE
|
||||
|
Reference in New Issue
Block a user