mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
* sysdeps/unix/bsd/bsd4.4/isatty.c: New file.
* sysdeps/unix/bsd/isatty.c (__isatty): Don't save and restore errno. * sysdeps/unix/bsd/ptsname.c (__ptsname_r): Return errno value from isatty unmodified. Reported by Bruno Haible <bruno@clisp.org>.
This commit is contained in:
@ -1,3 +1,11 @@
|
|||||||
|
2002-09-20 Roland McGrath <roland@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/unix/bsd/bsd4.4/isatty.c: New file.
|
||||||
|
|
||||||
|
* sysdeps/unix/bsd/isatty.c (__isatty): Don't save and restore errno.
|
||||||
|
* sysdeps/unix/bsd/ptsname.c (__ptsname_r): Return errno value from
|
||||||
|
isatty unmodified. Reported by Bruno Haible <bruno@clisp.org>.
|
||||||
|
|
||||||
2002-09-20 Steven Munroe <sjmunroe@us.ibm.com>
|
2002-09-20 Steven Munroe <sjmunroe@us.ibm.com>
|
||||||
|
|
||||||
* sysdeps/powerpc/bits/setjmp.h [__WORDSIZE]: Add 64-bit jmpbuf.
|
* sysdeps/powerpc/bits/setjmp.h [__WORDSIZE]: Add 64-bit jmpbuf.
|
||||||
|
3
sysdeps/unix/bsd/bsd4.4/isatty.c
Normal file
3
sysdeps/unix/bsd/bsd4.4/isatty.c
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
/* In a 4.4-derived world, tcgetattr is just one ioctl. */
|
||||||
|
|
||||||
|
#include <sysdeps/posix/isatty.c>
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
|
/* Copyright (C) 1991,95,96,97,2002 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -25,15 +25,8 @@ int
|
|||||||
__isatty (fd)
|
__isatty (fd)
|
||||||
int fd;
|
int fd;
|
||||||
{
|
{
|
||||||
int save;
|
|
||||||
int is_tty;
|
|
||||||
struct sgttyb term;
|
struct sgttyb term;
|
||||||
|
|
||||||
save = errno;
|
return __ioctl (fd, TIOCGETP, &term) == 0;
|
||||||
is_tty = __ioctl (fd, TIOCGETP, &term) == 0;
|
|
||||||
__set_errno (save);
|
|
||||||
|
|
||||||
return is_tty;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
weak_alias (__isatty, isatty)
|
weak_alias (__isatty, isatty)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1998 Free Software Foundation, Inc.
|
/* Copyright (C) 1998,2002 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -53,22 +53,20 @@ __ptsname_r (int fd, char *buf, size_t buflen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!__isatty (fd))
|
if (!__isatty (fd))
|
||||||
{
|
/* We rely on isatty to set errno properly (i.e. EBADF or ENOTTY). */
|
||||||
__set_errno (ENOTTY);
|
return errno;
|
||||||
return ENOTTY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buflen < strlen (_PATH_TTY) + 3)
|
if (buflen < strlen (_PATH_TTY) + 3)
|
||||||
{
|
{
|
||||||
__set_errno (ERANGE);
|
__set_errno (ERANGE);
|
||||||
return ERANGE;
|
return ERANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (__ttyname_r (fd, buf, buflen) != 0)
|
if (__ttyname_r (fd, buf, buflen) != 0)
|
||||||
return errno;
|
return errno;
|
||||||
|
|
||||||
buf[sizeof (_PATH_DEV) - 1] = 't';
|
buf[sizeof (_PATH_DEV) - 1] = 't';
|
||||||
|
|
||||||
if (__stat (buf, &st) < 0)
|
if (__stat (buf, &st) < 0)
|
||||||
return errno;
|
return errno;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user