From 0e66b7eb17bc1c1768b0a57cd62beac2a78b1b1a Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Sun, 5 May 2019 22:48:33 +0000
Subject: [PATCH] Abort the retry-loop in modem_command() if the process is
 being terminated (e.g. with ^C).

---
 src/sexpots/sexpots.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/sexpots/sexpots.c b/src/sexpots/sexpots.c
index 9d48a3461b..4ac10098b0 100644
--- a/src/sexpots/sexpots.c
+++ b/src/sexpots/sexpots.c
@@ -686,6 +686,8 @@ BOOL modem_command(COM_HANDLE com_handle, const char* cmd)
 	int		i;
 
 	for(i=0;i<=mdm_cmdretry;i++) {
+		if(terminated)
+			return FALSE;
 		if(i) {
 			lprintf(LOG_WARNING,"Retry #%u: sending modem command (%s) on %s", i, cmd, com_dev);
 			lprintf(LOG_DEBUG,"Dropping DTR on %s", com_dev);
-- 
GitLab