diff --git a/src/comio/comio.c b/src/comio/comio.c
index 63abbef1caa7a3fbf4cd966eac0580fccf519e85..ef901e2c9b4b8305c2b22d943ea8383d2f2809a4 100644
--- a/src/comio/comio.c
+++ b/src/comio/comio.c
@@ -30,7 +30,7 @@ size_t comReadBuf(COM_HANDLE handle, char* buf, size_t buflen, const char* termi
 
 	while(len < buflen) {
 		if(!comReadByte(handle, &ch)) {
-			if(timeout > 0 && msclock()-start >= timeout)
+			if(timeout != COM_INFINITE_TIMEOUT && msclock()-start >= timeout)
 				break;
 			YIELD();
 			continue;
diff --git a/src/comio/comio.h b/src/comio/comio.h
index 557381ba28d52fa5710637be26b19f82d1ec2f09..09cfc860cb0ad6292a9de1e39d4ae338d683caa6 100644
--- a/src/comio/comio.h
+++ b/src/comio/comio.h
@@ -38,9 +38,11 @@
 #ifndef _COMIO_H
 #define _COMIO_H
 
+#include <limits.h>	/* INT_MAX */
 #include <gen_defs.h>	/* BOOL */
 
 #define COM_ERROR						-1
+#define COM_INFINITE_TIMEOUT	INT_MIN
 
 #ifdef _WIN32
 	#if defined(COMIO_IMPORTS) || defined(COMIO_EXPORTS)
diff --git a/src/sexpots/sexpots.c b/src/sexpots/sexpots.c
index 8feaa2d382a6a5d5ef3a0125ece4f2b2afc05839..1d5a4406196d0cbe8681f2528522d0d776d06dd8 100644
--- a/src/sexpots/sexpots.c
+++ b/src/sexpots/sexpots.c
@@ -1592,10 +1592,13 @@ service_loop(int argc, char** argv)
 		comWriteString(com_handle, banner);
 		comWriteString(com_handle, "\r\n");
 		if(prompt[0] != '\0') {
+			int ptimeout = prompt_timeout * 1000;
+			if (ptimeout == 0)
+				ptimeout = COM_INFINITE_TIMEOUT;
 			parse_tcp_section("TCP");
 			comWriteString(com_handle, prompt);
 			char ch;
-			if(comReadBuf(com_handle, &ch, sizeof(ch), NULL, prompt_timeout * 1000)) {
+			if(comReadBuf(com_handle, &ch, sizeof(ch), NULL, ptimeout)) {
 				if(IS_CONTROL(ch))
 					lprintf(LOG_WARNING, "Received a control character (%d) in response to prompt", ch);
 				else {