OpenSM/osm_console.c: Handle telnet disconnects better

Signed-off-by: Sasha Khapyorsky <[EMAIL PROTECTED]>
Signed-off-by: Hal Rosenstock <[EMAIL PROTECTED]>

diff --git a/osm/opensm/osm_console.c b/osm/opensm/osm_console.c
index 420acc2..8d770aa 100644
--- a/osm/opensm/osm_console.c
+++ b/osm/opensm/osm_console.c
@@ -336,7 +336,7 @@ void osm_console(osm_opensm_t *p_osm)
        pollfd[1].events = POLLIN|POLLOUT;
        pollfd[1].revents = 0;
 
-       if (poll(pollfd, 2, 10000) <= 0)
+       if (poll(pollfd, pollfd[1].fd >= 0 ? 2 : 1, 10000) <= 0)
                return;
 
 #ifdef ENABLE_OSM_CONSOLE_SOCKET
@@ -382,11 +382,10 @@ void osm_console(osm_opensm_t *p_osm)
                if (n > 0) {
                        /* Parse and act on input */
                        parse_cmd_line(p_line, p_osm);
+                       osm_console_prompt(p_osm->console.out);
+               } else
+                       osm_console_close_socket(p_osm);
+               if (p_line)
                        free(p_line);
-               } else {
-                       fprintf(p_osm->console.out, "Input error\n");
-                       fflush(p_osm->console.out);
-               }
-               osm_console_prompt(p_osm->console.out);
        }
 }




_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to