summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2001-08-03 16:06:33 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2001-08-03 16:06:33 +0000
commit2082fe2919cef92399f22c887248fda3727069e7 (patch)
tree85fd353fb48964766214f8af099d95d7ea2fd3ee /cpukit
parentef5917dea2674f9f5d40e138595da47aa9d732fa (diff)
downloadrtems-2082fe2919cef92399f22c887248fda3727069e7.tar.bz2
2001-08-03 Joel Sherrill <joel@OARcorp.com>
* libc/libio_sockets.c (rtems_bsdnet_fdToSocket): Per bug report from Gene Smith <Gene.Smith@sea.siemens.com>, enhanced the error checking to account for a socket being closed.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/libcsupport/src/libio_sockets.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/cpukit/libcsupport/src/libio_sockets.c b/cpukit/libcsupport/src/libio_sockets.c
index 1b0ebb6ba0..a1e98c8b0a 100644
--- a/cpukit/libcsupport/src/libio_sockets.c
+++ b/cpukit/libcsupport/src/libio_sockets.c
@@ -31,11 +31,19 @@ struct socket *rtems_bsdnet_fdToSocket(
{
rtems_libio_t *iop;
+ /* same as rtems_libio_check_fd(_fd) but different return */
if ((unsigned32)fd >= rtems_libio_number_iops) {
errno = EBADF;
return NULL;
}
iop = &rtems_libio_iops[fd];
+
+ /* same as rtems_libio_check_is_open(iop) but different return */
+ if ((iop->flags & LIBIO_FLAGS_OPEN) == 0) {
+ errno = EBADF;
+ return NULL;
+ }
+
if (iop->data1 == NULL)
errno = EBADF;
return iop->data1;