summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libc/fstat.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1999-03-01 22:40:08 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1999-03-01 22:40:08 +0000
commit73f6236bc09b3cadf0aa030e16396154421f3e30 (patch)
tree30c344abe6e8091d860d583e0a1342af575ae791 /c/src/lib/libc/fstat.c
parentPart of the automake VI patch from Ralf Corsepius <corsepiu@faw.uni-ulm.de>: (diff)
downloadrtems-73f6236bc09b3cadf0aa030e16396154421f3e30.tar.bz2
Patch from Eric Norum <eric@skatter.usask.ca> to eliminate external
IO handlers scheme that was implemented originally just to support sockets. The file system IO switch is more general and works fine.
Diffstat (limited to 'c/src/lib/libc/fstat.c')
-rw-r--r--c/src/lib/libc/fstat.c37
1 files changed, 9 insertions, 28 deletions
diff --git a/c/src/lib/libc/fstat.c b/c/src/lib/libc/fstat.c
index 0399518532..7fdc2a4b8a 100644
--- a/c/src/lib/libc/fstat.c
+++ b/c/src/lib/libc/fstat.c
@@ -33,34 +33,6 @@ int fstat(
set_errno_and_return_minus_one( EFAULT );
/*
- * Zero out the stat structure so the various support
- * versions of stat don't have to.
- */
-
- memset( sbuf, 0, sizeof(struct stat) );
-
- /*
- * If this file descriptor is mapped to an external set of handlers,
- * then pass the request on to them.
- */
-
- if (rtems_file_descriptor_type(fd)) {
- switch (rtems_file_descriptor_type (fd)) {
- case RTEMS_FILE_DESCRIPTOR_TYPE_FILE:
- break;
-
- case RTEMS_FILE_DESCRIPTOR_TYPE_SOCKET:
-#if !defined(__GO32__)
- sbuf->st_mode = S_IFSOCK;
- break;
-#endif
-
- default:
- set_errno_and_return_minus_one( EBADF );
- }
- }
-
- /*
* Now process the stat() request.
*/
@@ -68,9 +40,18 @@ int fstat(
rtems_libio_check_fd( fd );
rtems_libio_check_is_open(iop);
+ if ( !iop->handlers )
+ set_errno_and_return_minus_one( EBADF );
+
if ( !iop->handlers->fstat )
set_errno_and_return_minus_one( ENOTSUP );
+ /*
+ * Zero out the stat structure so the various support
+ * versions of stat don't have to.
+ */
+ memset( sbuf, 0, sizeof(struct stat) );
+
return (*iop->handlers->fstat)( &iop->pathinfo, sbuf );
}