[hamradio-commits] [dump1090] 282/389: BUGFIX : Possible linked list bug
Matthew Ernisse
mernisse-guest at moszumanska.debian.org
Wed Nov 5 00:20:05 UTC 2014
This is an automated email from the git hooks/post-receive script.
mernisse-guest pushed a commit to branch master
in repository dump1090.
commit d20009924430a69723e00dd31c3bd0738a79e819
Author: Malcolm Robb <Support at ATTAvionics.com>
Date: Fri Apr 25 17:00:58 2014 +0100
BUGFIX : Possible linked list bug
---
Release/dump1090.exe | Bin 110592 -> 110592 bytes
Release/view1090.exe | Bin 90112 -> 90112 bytes
anet.c | 11 ++++-------
net_io.c | 7 ++++++-
winstubs.h | 1 -
5 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/Release/dump1090.exe b/Release/dump1090.exe
index bb8a2a1..f7a9cd1 100644
Binary files a/Release/dump1090.exe and b/Release/dump1090.exe differ
diff --git a/Release/view1090.exe b/Release/view1090.exe
index 21a927e..b6aacff 100644
Binary files a/Release/view1090.exe and b/Release/view1090.exe differ
diff --git a/anet.c b/anet.c
index 7552500..cbd7c6c 100644
--- a/anet.c
+++ b/anet.c
@@ -282,18 +282,15 @@ static int anetGenericAccept(char *err, int s, struct sockaddr *sa, socklen_t *l
while(1) {
fd = accept(s,sa,len);
if (fd == -1) {
-#ifdef _WIN32
- errno = WSAGetLastError();
-#endif
- if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) {
-
#ifndef _WIN32
- } else if (errno == EINTR) {
+ if (errno == EINTR) {
continue;
+#else
+ errno = WSAGetLastError();
+ if (errno == WSAEWOULDBLOCK) {
#endif
} else {
anetSetError(err, "accept: %s", strerror(errno));
- return ANET_ERR;
}
}
break;
diff --git a/net_io.c b/net_io.c
index add5956..98ce394 100644
--- a/net_io.c
+++ b/net_io.c
@@ -178,7 +178,9 @@ void modesSendAllClients(int service, void *msg, int len) {
struct client *c = Modes.clients;
while (c) {
+ // Read next before servicing client incase the service routine deletes the client!
struct client *next = c->next;
+
if (c->service == service) {
#ifndef _WIN32
int nwritten = write(c->fd, msg, len);
@@ -921,6 +923,9 @@ void modesReadFromClients(void) {
struct client *c = modesAcceptClients();
while (c) {
+ // Read next before servicing client incase the service routine deletes the client!
+ struct client *next = c->next;
+
if (c->service == Modes.ris) {
modesReadFromClient(c,"\n",decodeHexMessage);
} else if (c->service == Modes.bis) {
@@ -928,7 +933,7 @@ void modesReadFromClients(void) {
} else if (c->service == Modes.https) {
modesReadFromClient(c,"\r\n\r\n",handleHTTPRequest);
}
- c = c->next;
+ c = next;
}
}
//
diff --git a/winstubs.h b/winstubs.h
index f416668..5a6d575 100644
--- a/winstubs.h
+++ b/winstubs.h
@@ -101,7 +101,6 @@ _inline int gettimeofday(struct timeval *tv, struct timezone *tz) {
#define STDIN_FILENO 0
#define EINPROGRESS WSAEINPROGRESS
-#define EWOULDBLOCK WSAEWOULDBLOCK
#ifdef __cplusplus
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/dump1090.git
More information about the pkg-hamradio-commits
mailing list