2008-11-18 Joel Sherrill <joel.sherrill@oarcorp.com>
* libc/unix/ttyname.c: Use isatty() instead of tcgetattr().
This commit is contained in:
parent
efb00eb5da
commit
1f9aa7a3f0
|
@ -1,3 +1,7 @@
|
||||||
|
2008-11-18 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||||
|
|
||||||
|
* libc/unix/ttyname.c: Use isatty() instead of tcgetattr().
|
||||||
|
|
||||||
2008-11-18 Jeff Johnston <jjohnstn@redhat.com>
|
2008-11-18 Jeff Johnston <jjohnstn@redhat.com>
|
||||||
|
|
||||||
* libc/unix/basename.c: Add !_NO_BASENAME flag check so code can be
|
* libc/unix/basename.c: Add !_NO_BASENAME flag check so code can be
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <termios.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
|
@ -51,15 +50,14 @@ _DEFUN( ttyname_r,(fd, name, namesize),
|
||||||
size_t namesize)
|
size_t namesize)
|
||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
struct termios tty;
|
|
||||||
struct dirent *dirp;
|
struct dirent *dirp;
|
||||||
DIR *dp;
|
DIR *dp;
|
||||||
struct stat dsb;
|
struct stat dsb;
|
||||||
char buf[sizeof(ttyname_buf)];
|
char buf[sizeof(ttyname_buf)];
|
||||||
|
|
||||||
/* Must be a terminal. */
|
/* Must be a terminal. */
|
||||||
if (tcgetattr (fd, &tty) < 0)
|
if (!isatty(fd))
|
||||||
return errno; /* Can be EBADF or ENOTTY */
|
return ENOTTY;
|
||||||
|
|
||||||
/* Must be a character device. */
|
/* Must be a character device. */
|
||||||
if (fstat (fd, &sb) || !S_ISCHR (sb.st_mode))
|
if (fstat (fd, &sb) || !S_ISCHR (sb.st_mode))
|
||||||
|
|
Loading…
Reference in New Issue