From 7bf7b5d491822e8c4ccfa17b0a25822f89f03c95 Mon Sep 17 00:00:00 2001 From: Nick Patavalis Date: Sat, 20 Jan 2018 14:36:11 +0200 Subject: [PATCH] Explicitly unlock tty_fd when exiting with noreset --- picocom.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/picocom.c b/picocom.c index 644f3b3..2eb964f 100644 --- a/picocom.c +++ b/picocom.c @@ -674,6 +674,11 @@ cleanup (int drain, int noreset, int hup) if ( noreset ) { pinfo("Skipping tty reset...\r\n"); term_erase(tty_fd); +#ifdef USE_FLOCK + /* Explicitly unlock tty_fd before exiting. See + comments in term.c/term_exitfunc() for more. */ + flock(tty_fd, LOCK_UN); +#endif } }