diff options
-rw-r--r-- | ChangeLog | 27 | ||||
-rw-r--r-- | include/unistd.h | 1 | ||||
-rw-r--r-- | io/ftw.c | 10 | ||||
-rw-r--r-- | io/ftw64.c | 4 | ||||
-rw-r--r-- | malloc/mtrace.c | 4 | ||||
-rw-r--r-- | posix/spawni.c | 8 | ||||
-rw-r--r-- | resolv/res_data.c | 2 | ||||
-rw-r--r-- | sysdeps/generic/ftruncate64.c | 5 | ||||
-rw-r--r-- | sysdeps/generic/glob.c | 65 | ||||
-rw-r--r-- | sysdeps/generic/utmp_file.c | 26 | ||||
-rw-r--r-- | sysdeps/gnu/glob64.c | 2 | ||||
-rw-r--r-- | sysdeps/unix/opendir.c | 4 | ||||
-rw-r--r-- | sysdeps/unix/sysv/aix/ftruncate64.c | 5 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ftruncate64.c | 5 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/gethostid.c | 8 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/glob64.c | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/mips/ftruncate64.c | 5 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/ftruncate64.c | 5 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ttyname.c | 10 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ttyname_r.c | 10 |
20 files changed, 147 insertions, 61 deletions
@@ -1,5 +1,32 @@ 2001-02-13 Ulrich Drepper <drepper@redhat.com> + * io/ftw.c: Always use readdir64. + * io/ftw64.c: Likewise. + * sysdeps/unix/sysv/linux/ttyname.c: Likewise. + * sysdeps/unix/sysv/linux/ttyname_r.c: Likewise. + * sysdeps/generic/glob.c: Likewise. Convert results if gl_readdir + callback to dirent. Still allow compiling outside glibc. + * sysdeps/gnu/glob64.c: Define COMPILE_GLOB64. + * sysdeps/unix/sysv/linux/i386/glob64.c: Likewise. + + * malloc/mtrace.c: Use fopen64. + * posix/spawni.c: Use __open64. + * sysdeps/unix/opendir.c: Likewise. + * sysdeps/unix/sysv/linux/gethostid.c: Likewise. + + * sysdeps/generic/ftruncate64.c: Define __ftruncate64 and make old + name a weak alias. + * sysdeps/unix/sysv/aix/ftruncate64.c: Likewise. + * sysdeps/unix/sysv/linux/ftruncate64.c: Likewise. + * sysdeps/unix/sysv/linux/mips/ftruncate64.c: Likewise. + * sysdeps/unix/sysv/linux/powerpc/ftruncate64.c: Likewise. + + * resolv/res_data.c: Add cast to avoid warning. + + * include/unistd.h: Declare __ftruncate64. + + * sysdeps/generic/utmp_file.c: Use LFS functions and type. + * sysdeps/unix/sysv/linux/getdents.c (__GETDENTS): Use __lseek64 instead of __lseek. diff --git a/include/unistd.h b/include/unistd.h index cd51117078..3e258d35a5 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -88,6 +88,7 @@ extern ssize_t __write (int __fd, __const void *__buf, size_t __n); extern __pid_t __fork (void); extern int __getpagesize (void) __attribute__ ((__const__)); extern int __ftruncate (int __fd, __off_t __length); +extern int __ftruncate64 (int __fd, __off64_t __length); extern void *__sbrk (intptr_t __delta); @@ -37,8 +37,6 @@ # define NFTW_NAME nftw # define INO_T ino_t # define STAT stat -# define DIRENT dirent -# define READDIR __readdir # define LXSTAT __lxstat # define XSTAT __xstat # define FTW_FUNC_T __ftw_func_t @@ -163,10 +161,10 @@ open_dir_stream (struct ftw_data *data, struct dir_data *dirp) else { DIR *st = data->dirstreams[data->actdir]->stream; - struct DIRENT *d; + struct dirent64 *d; size_t actsize = 0; - while ((d = READDIR (st)) != NULL) + while ((d = __readdir64 (st)) != NULL) { size_t this_len = _D_EXACT_NAMLEN (d); if (actsize + this_len + 2 >= bufsize) @@ -340,7 +338,7 @@ internal_function ftw_dir (struct ftw_data *data, struct STAT *st) { struct dir_data dir; - struct DIRENT *d; + struct dirent64 *d; int previous_base = data->ftw.base; int result; char *startp; @@ -402,7 +400,7 @@ ftw_dir (struct ftw_data *data, struct STAT *st) *startp++ = '/'; data->ftw.base = startp - data->dirbuf; - while (dir.stream != NULL && (d = READDIR (dir.stream)) != NULL) + while (dir.stream != NULL && (d = __readdir64 (dir.stream)) != NULL) { result = process_entry (data, &dir, d->d_name, _D_EXACT_NAMLEN (d)); if (result != 0) diff --git a/io/ftw64.c b/io/ftw64.c index 6a3c93f88b..5294b9b2e2 100644 --- a/io/ftw64.c +++ b/io/ftw64.c @@ -1,5 +1,5 @@ /* File tree walker functions. LFS version. - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -22,8 +22,6 @@ #define NFTW_NAME nftw64 #define INO_T ino64_t #define STAT stat64 -#define DIRENT dirent64 -#define READDIR __readdir64 #define LXSTAT __lxstat64 #define XSTAT __xstat64 #define FTW_FUNC_T __ftw64_func_t diff --git a/malloc/mtrace.c b/malloc/mtrace.c index 0d170d62a0..d41c162a97 100644 --- a/malloc/mtrace.c +++ b/malloc/mtrace.c @@ -1,5 +1,5 @@ /* More debugging hooks for `malloc'. - Copyright (C) 1991,92,93,94,96,97,98,99,2000 Free Software Foundation, Inc. + Copyright (C) 1991-1994,1996-1999,2000,2001 Free Software Foundation, Inc. Written April 2, 1991 by John Gilmore of Cygnus Support. Based on mcheck.c by Mike Haertel. @@ -268,7 +268,7 @@ mtrace () #endif if (mallfile != NULL || mallwatch != NULL) { - mallstream = fopen (mallfile != NULL ? mallfile : "/dev/null", "w"); + mallstream = fopen64 (mallfile != NULL ? mallfile : "/dev/null", "w"); if (mallstream != NULL) { /* Make sure we close the file descriptor on exec. */ diff --git a/posix/spawni.c b/posix/spawni.c index 1fa97a0eea..fe4f27280c 100644 --- a/posix/spawni.c +++ b/posix/spawni.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2001 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 @@ -164,9 +164,9 @@ __spawni (pid_t *pid, const char *file, case spawn_do_open: { - int new_fd = __open (action->action.open_action.path, - action->action.open_action.oflag, - action->action.open_action.mode); + int new_fd = __open64 (action->action.open_action.path, + action->action.open_action.oflag, + action->action.open_action.mode); if (new_fd == -1) /* The `open' call failed. */ diff --git a/resolv/res_data.c b/resolv/res_data.c index a365698e82..968f820d5f 100644 --- a/resolv/res_data.c +++ b/resolv/res_data.c @@ -205,7 +205,7 @@ res_send_setrhook(res_send_rhook hook) { int res_isourserver(const struct sockaddr_in *inp) { - return (res_ourserver_p(&_res, inp)); + return (res_ourserver_p((const struct sockaddr_in6 *) &_res, inp)); } int diff --git a/sysdeps/generic/ftruncate64.c b/sysdeps/generic/ftruncate64.c index a85293baf6..ba27d2f43e 100644 --- a/sysdeps/generic/ftruncate64.c +++ b/sysdeps/generic/ftruncate64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2001 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 @@ -22,7 +22,7 @@ /* Truncate the file FD refers to to LENGTH bytes. */ int -ftruncate64 (fd, length) +__ftruncate64 (fd, length) int fd; off64_t length; { @@ -33,3 +33,4 @@ ftruncate64 (fd, length) } return __ftruncate (fd, (off_t) length); } +weak_alias (__ftruncate64, ftruncate64) diff --git a/sysdeps/generic/glob.c b/sysdeps/generic/glob.c index fd7e149539..3357bb3d17 100644 --- a/sysdeps/generic/glob.c +++ b/sysdeps/generic/glob.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as @@ -121,6 +121,40 @@ extern int errno; # define HAVE_D_TYPE 1 #endif +#if _LIBC +# define HAVE_DIRENT64 1 +#endif + +/* If the system has the `struct dirent64' type we use it internally. */ +#if defined HAVE_DIRENT64 && !defined COMPILE_GLOB64 +# if defined HAVE_DIRENT_H || defined __GNU_LIBRARY__ +# define CONVERT_D_NAMLEN(d64, d32) +# else +# define CONVERT_D_NAMLEN(d64, d32) \ + (d64)->d_namlen = (d32)->d_namlen; +# endif + +# if (defined POSIX || defined WINDOWS32) && !defined __GNU_LIBRARY__ +# define CONVERT_D_INO(d64, d32) +# else +# define CONVERT_D_INO(d64, d32) \ + (d64)->d_ino = (d32)->d_ino; +# endif + +# ifdef HAVE_D_TYPE +# define CONVERT_D_TYPE(d64, d32) \ + (d64)->d_type = (d32)->d_type; +# else +# define CONVERT_D_TYPE(d64, d32) +# endif + +# define CONVERT_DIRENT_DIRENT64(d64, d32) \ + memcpy ((d64)->d_name, (d32)->d_name, NAMLEN (d32)); \ + CONVERT_D_NAMLEN (d64, d32) \ + CONVERT_D_INO (d64, d32) \ + CONVERT_D_TYPE (d64, d32) +#endif + #if (defined POSIX || defined WINDOWS32) && !defined __GNU_LIBRARY__ /* Posix does not require that the d_ino field be present, and some @@ -246,7 +280,7 @@ extern char *alloca (); # define sysconf(id) __sysconf (id) # define closedir(dir) __closedir (dir) # define opendir(name) __opendir (name) -# define readdir(str) __readdir (str) +# define readdir(str) __readdir64 (str) # define getpwnam_r(name, bufp, buf, len, res) \ __getpwnam_r (name, bufp, buf, len, res) # ifndef __stat64 @@ -1339,10 +1373,29 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) { const char *name; size_t len; - struct dirent *d = - ((flags & GLOB_ALTDIRFUNC) - ? (struct dirent *)((*pglob->gl_readdir) (stream)) - : readdir ((DIR *) stream)); +#if defined HAVE_DIRENT64 && !defined COMPILE_GLOB64 + struct dirent64 *d; + struct dirent64 d64; + + if (flags & GLOB_ALTDIRFUNC) + { + struct dirent *d32 = (*pglob->gl_readdir) (stream); + if (d32 != NULL) + { + CONVERT_DIRENT_DIRENT64 (&d64, d32); + d = &d64; + } + else + d = NULL; + } + else + d = __readdir64 ((DIR *) stream); +#else + struct dirent *d = ((flags & GLOB_ALTDIRFUNC) + ? ((struct dirent *) + (*pglob->gl_readdir) (stream)) + : __readdir ((DIR *) stream)); +#endif if (d == NULL) break; if (! REAL_DIR_ENTRY (d)) diff --git a/sysdeps/generic/utmp_file.c b/sysdeps/generic/utmp_file.c index 2f172ffdbe..60178b3155 100644 --- a/sysdeps/generic/utmp_file.c +++ b/sysdeps/generic/utmp_file.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com> and Paul Janzen <pcj@primenet.com>, 1996. @@ -32,7 +32,7 @@ /* Descriptor for the file and position. */ static int file_fd = -1; -static off_t file_offset; +static off64_t file_offset; /* Cache for the last read entry. */ static struct utmp last_entry; @@ -138,7 +138,7 @@ setutent_file (void) } } - __lseek (file_fd, 0, SEEK_SET); + __lseek64 (file_fd, 0, SEEK_SET); file_offset = 0; #if _HAVE_UT_TYPE - 0 @@ -384,13 +384,13 @@ pututline_file (const struct utmp *data) if (found < 0) { /* We append the next entry. */ - file_offset = __lseek (file_fd, 0, SEEK_END); + file_offset = __lseek64 (file_fd, 0, SEEK_END); if (file_offset % sizeof (struct utmp) != 0) { file_offset -= file_offset % sizeof (struct utmp); - __ftruncate (file_fd, file_offset); + __ftruncate64 (file_fd, file_offset); - if (__lseek (file_fd, 0, SEEK_END) < 0) + if (__lseek64 (file_fd, 0, SEEK_END) < 0) { pbuf = NULL; goto unlock_return; @@ -401,7 +401,7 @@ pututline_file (const struct utmp *data) { /* We replace the just read entry. */ file_offset -= sizeof (struct utmp); - __lseek (file_fd, file_offset, SEEK_SET); + __lseek64 (file_fd, file_offset, SEEK_SET); } /* Write the new data. */ @@ -410,7 +410,7 @@ pututline_file (const struct utmp *data) /* If we appended a new record this is only partially written. Remove it. */ if (found < 0) - (void) __ftruncate (file_fd, file_offset); + (void) __ftruncate64 (file_fd, file_offset); pbuf = NULL; } else @@ -440,7 +440,7 @@ static int updwtmp_file (const char *file, const struct utmp *utmp) { int result = -1; - off_t offset; + off64_t offset; int fd; /* Open WTMP file. */ @@ -451,13 +451,13 @@ updwtmp_file (const char *file, const struct utmp *utmp) LOCK_FILE (fd, F_WRLCK); /* Remember original size of log file. */ - offset = __lseek (fd, 0, SEEK_END); + offset = __lseek64 (fd, 0, SEEK_END); if (offset % sizeof (struct utmp) != 0) { offset -= offset % sizeof (struct utmp); - __ftruncate (fd, offset); + __ftruncate64 (fd, offset); - if (__lseek (fd, 0, SEEK_END) < 0) + if (__lseek64 (fd, 0, SEEK_END) < 0) goto unlock_return; } @@ -466,7 +466,7 @@ updwtmp_file (const char *file, const struct utmp *utmp) will remain. */ if (__write (fd, utmp, sizeof (struct utmp)) != sizeof (struct utmp)) { - __ftruncate (fd, offset); + __ftruncate64 (fd, offset); goto unlock_return; } diff --git a/sysdeps/gnu/glob64.c b/sysdeps/gnu/glob64.c index 7fb4654b8b..1862603f67 100644 --- a/sysdeps/gnu/glob64.c +++ b/sysdeps/gnu/glob64.c @@ -17,4 +17,6 @@ #define NO_GLOB_PATTERN_P 1 +#define COMPILE_GLOB64 1 + #include <sysdeps/generic/glob.c> diff --git a/sysdeps/unix/opendir.c b/sysdeps/unix/opendir.c index 927caab70f..4b21e642e8 100644 --- a/sysdeps/unix/opendir.c +++ b/sysdeps/unix/opendir.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,92,93,94,95,96,98,2000 Free Software Foundation, Inc. +/* Copyright (C) 1991-1996,98,2000,2001 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 @@ -110,7 +110,7 @@ __opendir (const char *name) } } - fd = __open (name, O_RDONLY|O_NDELAY|EXTRA_FLAGS); + fd = __open64 (name, O_RDONLY|O_NDELAY|EXTRA_FLAGS); if (__builtin_expect (fd, 0) < 0) return NULL; diff --git a/sysdeps/unix/sysv/aix/ftruncate64.c b/sysdeps/unix/sysv/aix/ftruncate64.c index 56a5ed58c1..f2c1578a18 100644 --- a/sysdeps/unix/sysv/aix/ftruncate64.c +++ b/sysdeps/unix/sysv/aix/ftruncate64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2000, 2001 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 @@ -21,7 +21,8 @@ extern int kftruncate (int fd, long long int length); int -ftruncate64 (int fd, off64_t length) +__ftruncate64 (int fd, off64_t length) { return kftruncate (fd, length); } +weak_alias (__ftruncate64, ftruncate64) diff --git a/sysdeps/unix/sysv/linux/ftruncate64.c b/sysdeps/unix/sysv/linux/ftruncate64.c index f3f99c4ca2..6ff78d7e3d 100644 --- a/sysdeps/unix/sysv/linux/ftruncate64.c +++ b/sysdeps/unix/sysv/linux/ftruncate64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 1999, 2000, 2001 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 @@ -38,7 +38,7 @@ extern int __syscall_ftruncate64 (int fd, int high_length, int low_length); /* Truncate the file FD refers to to LENGTH bytes. */ int -ftruncate64 (int fd, off64_t length) +__ftruncate64 (int fd, off64_t length) { #ifndef __ASSUME_TRUNCATE64_SYSCALL if (! __have_no_truncate64) @@ -71,6 +71,7 @@ ftruncate64 (int fd, off64_t length) return __ftruncate (fd, (off_t) length); #endif } +weak_alias (__ftruncate64, ftruncate64) #else /* Use the generic implementation. */ diff --git a/sysdeps/unix/sysv/linux/gethostid.c b/sysdeps/unix/sysv/linux/gethostid.c index f19d515abd..f0420f3e22 100644 --- a/sysdeps/unix/sysv/linux/gethostid.c +++ b/sysdeps/unix/sysv/linux/gethostid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1998,1999,2000,2001 Free Software Foundation, Inc. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as @@ -40,7 +40,7 @@ sethostid (id) } /* Open file for writing. Everybody is allowed to read this file. */ - fd = __open (HOSTIDFILE, O_CREAT|O_WRONLY|O_TRUNC, 0644); + fd = __open64 (HOSTIDFILE, O_CREAT|O_WRONLY|O_TRUNC, 0644); if (fd < 0) return -1; @@ -70,9 +70,9 @@ gethostid () int fd; /* First try to get the ID from a former invocation of sethostid. */ - fd = __open (HOSTIDFILE, O_RDONLY); + fd = __open64 (HOSTIDFILE, O_RDONLY); if (fd < 0) - fd = __open (OLD_HOSTIDFILE, O_RDONLY); + fd = __open64 (OLD_HOSTIDFILE, O_RDONLY); if (fd >= 0) { ssize_t n = __read (fd, &id, sizeof (id)); diff --git a/sysdeps/unix/sysv/linux/i386/glob64.c b/sysdeps/unix/sysv/linux/i386/glob64.c index 9f32742034..5d2349d26b 100644 --- a/sysdeps/unix/sysv/linux/i386/glob64.c +++ b/sysdeps/unix/sysv/linux/i386/glob64.c @@ -17,6 +17,8 @@ #define NO_GLOB_PATTERN_P 1 +#define COMPILE_GLOB64 1 + #include <sysdeps/generic/glob.c> #include "shlib-compat.h" diff --git a/sysdeps/unix/sysv/linux/mips/ftruncate64.c b/sysdeps/unix/sysv/linux/mips/ftruncate64.c index e45afbad7d..bc03e0c550 100644 --- a/sysdeps/unix/sysv/linux/mips/ftruncate64.c +++ b/sysdeps/unix/sysv/linux/mips/ftruncate64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 1999, 2000, 2001 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 @@ -39,7 +39,7 @@ extern int __syscall_ftruncate64 (int fd, int dummy, int high_length, /* Truncate the file FD refers to to LENGTH bytes. */ int -ftruncate64 (int fd, off64_t length) +__ftruncate64 (int fd, off64_t length) { #ifndef __ASSUME_TRUNCATE64_SYSCALL if (! __have_no_truncate64) @@ -72,6 +72,7 @@ ftruncate64 (int fd, off64_t length) return __ftruncate (fd, (off_t) length); #endif } +weak_alias (__ftruncate64, ftruncate64) #else /* Use the generic implementation. */ diff --git a/sysdeps/unix/sysv/linux/powerpc/ftruncate64.c b/sysdeps/unix/sysv/linux/powerpc/ftruncate64.c index a39624b2af..bfdbf8b589 100644 --- a/sysdeps/unix/sysv/linux/powerpc/ftruncate64.c +++ b/sysdeps/unix/sysv/linux/powerpc/ftruncate64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 1999, 2000, 2001 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 @@ -36,7 +36,7 @@ extern int __syscall_ftruncate64 (int fd, off64_t length); /* Truncate the file FD refers to to LENGTH bytes. */ int -ftruncate64 (fd, length) +__ftruncate64 (fd, length) int fd; off64_t length; { @@ -69,6 +69,7 @@ ftruncate64 (fd, length) return __ftruncate (fd, (off_t) length); #endif } +weak_alias (__ftruncate64, ftruncate64) #else /* Use the generic implementation. */ diff --git a/sysdeps/unix/sysv/linux/ttyname.c b/sysdeps/unix/sysv/linux/ttyname.c index 9a5009932a..34ef12c205 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,99,2000 Free Software Foundation, Inc. +/* Copyright (C) 1991,92,93,1996-1999,2000,2001 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 @@ -44,7 +44,7 @@ getttyname (const char *dev, dev_t mydev, ino64_t myino, int save, int *dostat) static size_t namelen; struct stat64 st; DIR *dirstream; - struct dirent *d; + struct dirent64 *d; size_t devlen = strlen (dev) + 1; dirstream = __opendir (dev); @@ -54,8 +54,8 @@ getttyname (const char *dev, dev_t mydev, ino64_t myino, int save, int *dostat) return NULL; } - while ((d = __readdir (dirstream)) != NULL) - if (((ino_t) d->d_fileno == myino || *dostat) + while ((d = __readdir64 (dirstream)) != NULL) + if ((d->d_fileno == myino || *dostat) && strcmp (d->d_name, "stdin") && strcmp (d->d_name, "stdout") && strcmp (d->d_name, "stderr")) @@ -80,7 +80,7 @@ getttyname (const char *dev, dev_t mydev, ino64_t myino, int save, int *dostat) #ifdef _STATBUF_ST_RDEV && S_ISCHR (st.st_mode) && st.st_rdev == mydev #else - && (ino64_t) d->d_fileno == myino && st.st_dev == mydev + && d->d_fileno == myino && st.st_dev == mydev #endif ) { diff --git a/sysdeps/unix/sysv/linux/ttyname_r.c b/sysdeps/unix/sysv/linux/ttyname_r.c index 87dadc1dd7..4dedcd7e00 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,99,2000 Free Software Foundation, Inc. +/* Copyright (C) 1991,92,93,1995-1999,2000,2001 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 @@ -39,7 +39,7 @@ getttyname_r (char *buf, size_t buflen, dev_t mydev, ino64_t myino, { struct stat64 st; DIR *dirstream; - struct dirent *d; + struct dirent64 *d; size_t devlen = strlen (buf); dirstream = __opendir (buf); @@ -49,8 +49,8 @@ getttyname_r (char *buf, size_t buflen, dev_t mydev, ino64_t myino, return errno; } - while ((d = __readdir (dirstream)) != NULL) - if (((ino_t) d->d_fileno == myino || *dostat) + while ((d = __readdir64 (dirstream)) != NULL) + if ((d->d_fileno == myino || *dostat) && strcmp (d->d_name, "stdin") && strcmp (d->d_name, "stdout") && strcmp (d->d_name, "stderr")) @@ -73,7 +73,7 @@ getttyname_r (char *buf, size_t buflen, dev_t mydev, ino64_t myino, #ifdef _STATBUF_ST_RDEV && S_ISCHR (st.st_mode) && st.st_rdev == mydev #else - && (ino64_t) d->d_fileno == myino && st.st_dev == mydev + && d->d_fileno == myino && st.st_dev == mydev #endif ) { |