summaryrefslogtreecommitdiffstats
path: root/c/src/lib
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1998-09-29 12:15:08 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1998-09-29 12:15:08 +0000
commit766ed7c0f132488646599d0cd73a25ffe1eecf34 (patch)
tree0c1f6656e0fa957ef59ce29e0fc3e3c55fcfc159 /c/src/lib
parentAdded sentence to indicate sections were deliberately empty. (diff)
downloadrtems-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 'c/src/lib')
-rw-r--r--c/src/lib/libnetworking/rtems/rtems_syscall.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/c/src/lib/libnetworking/rtems/rtems_syscall.c b/c/src/lib/libnetworking/rtems/rtems_syscall.c
index a526eb2254..782a2f907b 100644
--- a/c/src/lib/libnetworking/rtems/rtems_syscall.c
+++ b/c/src/lib/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;
}