diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-01-15 14:13:19 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-01-20 07:11:58 +0100 |
commit | f87ede57a2e97f0743a85b94072c7163fa485ae9 (patch) | |
tree | 827af0350535dde1db7f1ae5d80226eb3a62533d /testsuites/samples | |
parent | libnetworking: Delete dead code (diff) | |
download | rtems-f87ede57a2e97f0743a85b94072c7163fa485ae9.tar.bz2 |
libnetworking: Fix close of active sockets
Send a special event to notify tasks waiting for a socket state change
in case this socket gets closed. This prevents a use after free.
Close #785.
Diffstat (limited to 'testsuites/samples')
-rw-r--r-- | testsuites/samples/loopback/init.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/testsuites/samples/loopback/init.c b/testsuites/samples/loopback/init.c index 7ac376fbe8..ccaf3c65ce 100644 --- a/testsuites/samples/loopback/init.c +++ b/testsuites/samples/loopback/init.c @@ -167,7 +167,10 @@ static rtems_task serverTask(rtems_task_argument arg) addrlen = sizeof farAddr; s1 = accept(s, (struct sockaddr *)&farAddr, &addrlen); if (s1 < 0) - rtems_panic("Can't accept connection: %s", strerror(errno)); + if (errno == ENXIO) + rtems_task_delete(RTEMS_SELF); + else + rtems_panic("Can't accept connection: %s", strerror(errno)); else printf("ACCEPTED:%lX\n", ntohl(farAddr.sin_addr.s_addr)); spawnTask(workerTask, myPriority, s1); |