From: Ulrich Drepper Date: Mon, 22 Feb 1999 18:08:28 +0000 (+0000) Subject: Update. X-Git-Tag: upstream/2.30~27536 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4985fb53859f7aab18676cdaeb7a620571269976;p=external%2Fglibc.git Update. 1999-02-22 Ulrich Drepper * sysdeps/unix/sysv/linux/ttyname.c: Use __xstat and __fxstat instead of stat and fstat. * sysdeps/unix/sysv/linux/ttyname_r.c: Likewise. --- diff --git a/ChangeLog b/ChangeLog index 055c014..435c18d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +1999-02-22 Ulrich Drepper + + * sysdeps/unix/sysv/linux/ttyname.c: Use __xstat and __fxstat + instead of stat and fstat. + * sysdeps/unix/sysv/linux/ttyname_r.c: Likewise. + 1999-02-23 Andreas Schwab * elf/dl-error.c (_dl_signal_cerror): New function. diff --git a/sysdeps/unix/sysv/linux/ttyname.c b/sysdeps/unix/sysv/linux/ttyname.c index 6ea406a..a32d1a6 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) diff --git a/sysdeps/unix/sysv/linux/ttyname_r.c b/sysdeps/unix/sysv/linux/ttyname_r.c index fe68e10..b92c712 100644 --- a/sysdeps/unix/sysv/linux/ttyname_r.c +++ b/sysdeps/unix/sysv/linux/ttyname_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 93, 95, 96, 97, 98 Free Software Foundation, Inc. +/* Copyright (C) 1991,92,93,95,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 @@ -74,7 +74,7 @@ getttyname_r (buf, buflen, mydev, myino, save, dostat) cp = __stpncpy (buf + devlen, d->d_name, needed); cp[0] = '\0'; - if (stat (buf, &st) == 0 + if (__xstat (_STAT_VER, buf, &st) == 0 #ifdef _STATBUF_ST_RDEV && S_ISCHR (st.st_mode) && st.st_rdev == mydev #else @@ -141,14 +141,14 @@ __ttyname_r (fd, buf, buflen) return ERANGE; } - if (fstat (fd, &st) < 0) + if (__fxstat (_STAT_VER, fd, &st) < 0) return errno; /* Prepare the result buffer. */ memcpy (buf, "/dev/pts/", sizeof ("/dev/pts/")); buflen -= sizeof ("/dev/pts/") - 1; - if (stat (buf, &st1) == 0 && S_ISDIR (st1.st_mode)) + if (__xstat (_STAT_VER, buf, &st1) == 0 && S_ISDIR (st1.st_mode)) { #ifdef _STATBUF_ST_RDEV ret = getttyname_r (buf, buflen, st.st_rdev, st.st_ino, save,