From 10862c46e8cfc77b4063bf024686036c10277f72 Mon Sep 17 00:00:00 2001 From: dmiller Date: Fri, 23 Sep 2022 14:49:40 +0000 Subject: [PATCH] Don't bother with interactive input if we can't open the TTY. See #2042 --- nmap_tty.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nmap_tty.cc b/nmap_tty.cc index 8c748bc23..09145411f 100644 --- a/nmap_tty.cc +++ b/nmap_tty.cc @@ -224,7 +224,10 @@ void tty_init() if (tty_fd) return; - if ((tty_fd = open("/dev/tty", O_RDONLY | O_NONBLOCK)) < 0) return; + if ((tty_fd = open("/dev/tty", O_RDONLY | O_NONBLOCK)) < 0) { + o.noninteractive = true; + return; + } #ifndef __CYGWIN32__ if (tcgetpgrp(tty_fd) != getpgrp()) {