From 4898fdb7b00660281514fa7a7de2403e8145849c Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 8 Apr 2021 15:06:34 +0100 Subject: [PATCH] try to get disconnect to close socket, ah well --- small_jtag_test/main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/small_jtag_test/main.cpp b/small_jtag_test/main.cpp index ed7a2a6..7859f64 100644 --- a/small_jtag_test/main.cpp +++ b/small_jtag_test/main.cpp @@ -100,7 +100,12 @@ int read_handler(int fdread, char *buffer) case 0: return 0; // timeout (nothing read) default: - return read(fdread, buffer, 1); + status = read(fdread, buffer, 1); + if (status == -1) { + printf("Error reading on socket\n"); + close(fdread); + } + return status; } } -- 2.30.2