server/server: fix clang static analyzer warning
authorTomas Vanek <vanekt@fbl.cz>
Fri, 20 Dec 2019 22:40:07 +0000 (23:40 +0100)
committerTomas Vanek <vanekt@fbl.cz>
Thu, 16 Jan 2020 09:44:49 +0000 (09:44 +0000)
Change-Id: I317e189b62540e3688a20d88a95f551280317f14
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5373
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
src/server/server.c

index 9e63f74f41d023030fc0c7624303fdd790dd79ff..8e641176ad74c6fa9d00bce33b4eac12debcc519 100644 (file)
@@ -562,7 +562,7 @@ int server_loop(struct command_context *command_context)
                                struct connection *c;
 
                                for (c = service->connections; c; ) {
-                                       if ((FD_ISSET(c->fd, &read_fds)) || c->input_pending) {
+                                       if ((c->fd >= 0 && FD_ISSET(c->fd, &read_fds)) || c->input_pending) {
                                                retval = service->input(c);
                                                if (retval != ERROR_OK) {
                                                        struct connection *next = c->next;