diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1998-09-29 12:15:08 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1998-09-29 12:15:08 +0000 |
commit | 766ed7c0f132488646599d0cd73a25ffe1eecf34 (patch) | |
tree | 0c1f6656e0fa957ef59ce29e0fc3e3c55fcfc159 /cpukit/libnetworking/rtems/rtems_syscall.c | |
parent | Added sentence to indicate sections were deliberately empty. (diff) | |
download | rtems-766ed7c0f132488646599d0cd73a25ffe1eecf34.tar.bz2 |
Patch from Eric Norum <eric@skatter.usask.ca>:
Remember the test to see if a socket could be read and written at
the same time by two different tasks? I discovered that if both
tasks attempt to close the socket a panic can occur from inside the
BSD code.
Closing the same socket twice from two different threads is
certainly an error, but a panic is not the greatest error reporting
method :-)
The following small change to the socket close routine should reduce
the chances of the panic.
Diffstat (limited to '')
-rw-r--r-- | cpukit/libnetworking/rtems/rtems_syscall.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/cpukit/libnetworking/rtems/rtems_syscall.c b/cpukit/libnetworking/rtems/rtems_syscall.c index a526eb2254..782a2f907b 100644 --- a/cpukit/libnetworking/rtems/rtems_syscall.c +++ b/cpukit/libnetworking/rtems/rtems_syscall.c @@ -683,16 +683,15 @@ rtems_bsdnet_close (int fd) rtems_bsdnet_semaphore_release (); return -1; } - error = soclose (so); i = rtems_file_descriptor_base(fd); fdsock[i].indexFreeNext = indexFreeHead;; indexFreeHead = i; + error = soclose (so); + rtems_bsdnet_semaphore_release (); if (error) { errno = error; - rtems_bsdnet_semaphore_release (); return -1; } - rtems_bsdnet_semaphore_release (); return 0; } |