diff options
Diffstat (limited to 'io')
-rw-r--r-- | io/Makefile | 1 | ||||
-rw-r--r-- | io/fcntl.h | 7 | ||||
-rw-r--r-- | io/isatty_nostatus.c | 29 |
3 files changed, 34 insertions, 3 deletions
diff --git a/io/Makefile b/io/Makefile index e06f3cb..edee38e 100644 --- a/io/Makefile +++ b/io/Makefile @@ -92,6 +92,7 @@ routines := \ getdirname \ getwd \ isatty \ + isatty_nostatus \ lchmod \ lchown \ link \ @@ -281,16 +281,17 @@ extern int creat64 (const char *__file, mode_t __mode) __nonnull ((1)); # define F_TEST 3 /* Test a region for other processes locks. */ # ifndef __USE_FILE_OFFSET64 -extern int lockf (int __fd, int __cmd, off_t __len); +extern int lockf (int __fd, int __cmd, off_t __len) __wur; # else # ifdef __REDIRECT -extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), lockf64); +extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), + lockf64) __wur; # else # define lockf lockf64 # endif # endif # ifdef __USE_LARGEFILE64 -extern int lockf64 (int __fd, int __cmd, off64_t __len); +extern int lockf64 (int __fd, int __cmd, off64_t __len) __wur; # endif #endif diff --git a/io/isatty_nostatus.c b/io/isatty_nostatus.c new file mode 100644 index 0000000..e8ee796 --- /dev/null +++ b/io/isatty_nostatus.c @@ -0,0 +1,29 @@ +/* Copyright (C) 1991-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <unistd.h> + +/* Return 1 if FD is a terminal, 0 if not, without changing errno */ +int +__isatty_nostatus (int fd) +{ + int save_errno = errno; + int res = __isatty (fd); + __set_errno (save_errno); + return res; +} |