aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-02-22 18:08:28 +0000
committerUlrich Drepper <drepper@redhat.com>1999-02-22 18:08:28 +0000
commit4985fb53859f7aab18676cdaeb7a620571269976 (patch)
treeb204c7659189f4022a892f5a7578d55cd67ca39b /sysdeps/unix/sysv/linux/ttyname.c
parentUpdate. (diff)
downloadglibc-4985fb53859f7aab18676cdaeb7a620571269976.tar.gz
glibc-4985fb53859f7aab18676cdaeb7a620571269976.tar.bz2
glibc-4985fb53859f7aab18676cdaeb7a620571269976.zip
Update.
1999-02-22 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/ttyname.c: Use __xstat and __fxstat instead of stat and fstat. * sysdeps/unix/sysv/linux/ttyname_r.c: Likewise.
Diffstat (limited to 'sysdeps/unix/sysv/linux/ttyname.c')
-rw-r--r--sysdeps/unix/sysv/linux/ttyname.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sysdeps/unix/sysv/linux/ttyname.c b/sysdeps/unix/sysv/linux/ttyname.c
index 6ea406a8b8..a32d1a6605 100644
--- a/sysdeps/unix/sysv/linux/ttyname.c
+++ b/sysdeps/unix/sysv/linux/ttyname.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 96, 97, 98 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 96, 97, 98, 99 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
@@ -79,7 +79,7 @@ getttyname (dev, mydev, myino, save, dostat)
*((char *) __mempcpy (name, dev, devlen - 1)) = '/';
}
memcpy (&name[devlen], d->d_name, dlen);
- if (stat (name, &st) == 0
+ if (__xstat (_STAT_VER, name, &st) == 0
#ifdef _STATBUF_ST_RDEV
&& S_ISCHR (st.st_mode) && st.st_rdev == mydev
#else
@@ -107,6 +107,7 @@ ttyname (fd)
{
static char *buf;
static size_t buflen = 0;
+ static int dev_pts_available = 1;
char procname[30];
struct stat st, st1;
int dostat = 0;
@@ -135,10 +136,11 @@ ttyname (fd)
&& buf[0] != '[')
return buf;
- if (fstat (fd, &st) < 0)
+ if (__fxstat (_STAT_VER, fd, &st) < 0)
return NULL;
- if (stat ("/dev/pts", &st1) == 0 && S_ISDIR (st1.st_mode))
+ if (dev_pts_available
+ && __xstat (_STAT_VER, "/dev/pts", &st1) == 0 && S_ISDIR (st1.st_mode))
{
#ifdef _STATBUF_ST_RDEV
name = getttyname ("/dev/pts", st.st_rdev, st.st_ino, save, &dostat);
@@ -150,6 +152,7 @@ ttyname (fd)
{
__set_errno (save);
name = NULL;
+ dev_pts_available = 1;
}
if (!name && dostat != -1)