diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/unix/opendir.c | 19 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/bits/socket.h | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c | 1 | ||||
-rw-r--r-- | sysdeps/wordsize-32/inttypes.h | 16 | ||||
-rw-r--r-- | sysdeps/wordsize-64/inttypes.h | 16 |
5 files changed, 29 insertions, 25 deletions
diff --git a/sysdeps/unix/opendir.c b/sysdeps/unix/opendir.c index ef7bc84..4df06ed 100644 --- a/sysdeps/unix/opendir.c +++ b/sysdeps/unix/opendir.c @@ -47,6 +47,17 @@ __opendir (const char *name) return NULL; } + /* We first have to check whether the name is for a directory. We + cannot do this after the open() call since the open/close operation + performed on, say, a tape device might have undesirable effects. */ + if (stat (name, &statbuf) < 0) + return NULL; + if (! S_ISDIR (statbuf.st_mode)) + { + __set_errno (ENOTDIR); + return NULL; + } + fd = __open (name, O_RDONLY|O_NDELAY); if (fd < 0) return NULL; @@ -54,14 +65,6 @@ __opendir (const char *name) if (__fcntl (fd, F_SETFD, FD_CLOEXEC) < 0) goto lose; - if (fstat (fd, &statbuf) < 0) - goto lose; - if (! S_ISDIR (statbuf.st_mode)) - { - save_errno = ENOTDIR; - goto lose2; - } - #ifdef _STATBUF_ST_BLKSIZE if (statbuf.st_blksize < sizeof (struct dirent)) allocation = sizeof (struct dirent); diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h index 47d7061..30ba59f 100644 --- a/sysdeps/unix/sysv/linux/bits/socket.h +++ b/sysdeps/unix/sysv/linux/bits/socket.h @@ -200,7 +200,7 @@ struct cmsghdr extern struct cmsghdr *__cmsg_nxthdr __P ((struct msghdr *__mhdr, struct cmsghdr *__cmsg)); _EXTERN_INLINE struct cmsghdr * -__cmsg_nxthdr __P ((struct msghdr *__mhdr, struct cmsghdr *__cmsg)) +__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) __THROW { if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr)) /* The kernel header does this so there may be a reason. */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c b/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c index ae44328..e18ffa8 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c @@ -18,6 +18,7 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include <string.h> #include <syscall.h> #include <sys/signal.h> #include <errno.h> diff --git a/sysdeps/wordsize-32/inttypes.h b/sysdeps/wordsize-32/inttypes.h index 48c97b3..5897fda 100644 --- a/sysdeps/wordsize-32/inttypes.h +++ b/sysdeps/wordsize-32/inttypes.h @@ -278,8 +278,8 @@ extern long long int __strtoll_internal __P ((__const char *__restrict __nptr, # define __strtoll_internal_defined 1 # endif extern __inline intmax_t -strtoimax __P ((__const char *__restrict nptr, char **__restrict endptr, - int base)) +strtoimax (__const char *__restrict nptr, char **__restrict endptr, + int base) __THROW { return __strtoll_internal (nptr, endptr, base, 0); } @@ -296,8 +296,8 @@ extern unsigned long long int __strtoull_internal __P ((__const char * # define __strtoull_internal_defined 1 # endif extern __inline uintmax_t -strtoumax __P ((__const char *__restrict nptr, char **__restrict endptr, - int base)) +strtoumax (__const char *__restrict nptr, char **__restrict endptr, + int base) __THROW { return __strtoull_internal (nptr, endptr, base, 0); } @@ -312,8 +312,8 @@ extern long long int __wcstoll_internal __P ((__const wchar_t * # define __wcstoll_internal_defined 1 # endif extern __inline intmax_t -wcstoimax __P ((__const wchar_t *__restrict nptr, wchar_t **__restrict endptr, - int base)) +wcstoimax (__const wchar_t *__restrict nptr, wchar_t **__restrict endptr, + int base) __THROW { return __wcstoll_internal (nptr, endptr, base, 0); } @@ -331,8 +331,8 @@ extern unsigned long long int __wcstoull_internal __P ((__const wchar_t * # define __wcstoull_internal_defined 1 # endif extern __inline uintmax_t -wcstoumax __P ((__const wchar_t *__restrict nptr, wchar_t **__restrict endptr, - int base)) +wcstoumax (__const wchar_t *__restrict nptr, wchar_t **__restrict endptr, + int base) __THROW { return __wcstoull_internal (nptr, endptr, base, 0); } diff --git a/sysdeps/wordsize-64/inttypes.h b/sysdeps/wordsize-64/inttypes.h index 48a7c8f..f37221b 100644 --- a/sysdeps/wordsize-64/inttypes.h +++ b/sysdeps/wordsize-64/inttypes.h @@ -277,8 +277,8 @@ extern long int __strtol_internal __P ((__const char *__restrict __nptr, # define __strtol_internal_defined 1 # endif extern __inline intmax_t -strtoimax __P ((__const char *__restrict nptr, char **__restrict endptr, - int base)) +strtoimax (__const char *__restrict nptr, char **__restrict endptr, + int base) __THROW { return __strtol_internal (nptr, endptr, base, 0); } @@ -292,8 +292,8 @@ extern unsigned long int __strtoul_internal __P ((__const char * # define __strtoul_internal_defined 1 # endif extern __inline uintmax_t -strtoumax __P ((__const char *__restrict nptr, char **__restrict endptr, - int base)) +strtoumax (__const char *__restrict nptr, char **__restrict endptr, + int base) __THROW { return __strtoul_internal (nptr, endptr, base, 0); } @@ -306,8 +306,8 @@ extern long int __wcstol_internal __P ((__const wchar_t * __restrict __nptr, # define __wcstol_internal_defined 1 # endif extern __inline intmax_t -wcstoimax __P ((__const wchar_t *__restrict nptr, wchar_t **__restrict endptr, - int base)) +wcstoimax (__const wchar_t *__restrict nptr, wchar_t **__restrict endptr, + int base) __THROW { return __wcstol_internal (nptr, endptr, base, 0); } @@ -323,8 +323,8 @@ extern unsigned long int __wcstoul_internal __P ((__const wchar_t * # define __wcstoul_internal_defined 1 # endif extern __inline uintmax_t -wcstoumax __P ((__const wchar_t *__restrict nptr, wchar_t **__restrict endptr, - int base)) +wcstoumax (__const wchar_t *__restrict nptr, wchar_t **__restrict endptr, + int base) __THROW { return __wcstoul_internal (nptr, endptr, base, 0); } |