From 8eab62945d9291f9d636b35a22cb60fc93deb1fb Mon Sep 17 00:00:00 2001 From: Nick Patavalis Date: Sat, 20 Jan 2018 16:45:48 +0200 Subject: [PATCH] Close tty_fd after resetting and before exiting --- picocom.c | 2 ++ term.c | 1 + 2 files changed, 3 insertions(+) diff --git a/picocom.c b/picocom.c index 2eb964f..12d9c1a 100644 --- a/picocom.c +++ b/picocom.c @@ -679,6 +679,8 @@ cleanup (int drain, int noreset, int hup) comments in term.c/term_exitfunc() for more. */ flock(tty_fd, LOCK_UN); #endif + close(tty_fd); + tty_fd = -1; } } diff --git a/term.c b/term.c index 93b99f9..76b38cc 100644 --- a/term.c +++ b/term.c @@ -421,6 +421,7 @@ term_exitfunc (void) set). */ flock(term.fd[i], LOCK_UN); #endif + close(term.fd[i]); term.fd[i] = -1; } } while (0);