[Openvpn-devel,v2] Assume termios.h is available on all non Windows platforms

Message ID 20261003132620.12292-1-gert@greenie.muc.de
State New
Headers
Series [Openvpn-devel,v2] Assume termios.h is available on all non Windows platforms |

Commit Message

Gert Doering Oct. 3, 2026, 1:26 p.m. UTC
  From: Arne Schwabe <arne@rfc2549.org>

Checking for something that is available on all (non Windows) platforms
is not very useful. So just always use termios.h

Change-Id: I09b055f15e35614eab112ff69166c6985f8770da
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1967
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1967
This mail reflects revision 2 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <gert@greenie.muc.de>
Frank Lichtenheld <frank@lichtenheld.com>
  

Comments

Gert Doering Oct. 3, 2026, 3:22 p.m. UTC | #1
Thanks for reducing the amount of #ifdefs and configure tests for stuff
we can take for granted ;-) (exept on win32, of course) - and BB confirms
that indeed that gut feeling is correct...

Your patch has been applied to the master branch.

commit 2484e658c46d56910c9a7b6ce22ffa2144b12293
Author: Arne Schwabe
Date:   Sat Oct 3 15:26:14 2026 +0200

     Assume termios.h is available on all non Windows platforms

     Signed-off-by: Arne Schwabe <arne@rfc2549.org>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1967
     Message-Id: <20261003132620.12292-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg39661.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering
  

Patch

diff --git a/configure.ac b/configure.ac
index 1fa0e63..195116f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -459,7 +459,7 @@ 
 	sys/time.h sys/ioctl.h sys/stat.h \
 	sys/mman.h sys/file.h sys/wait.h \
 	libgen.h stropts.h \
-	syslog.h pwd.h grp.h termios.h \
+	syslog.h pwd.h grp.h \
 	sys/sockio.h sys/uio.h \
 	poll.h sys/epoll.h err.h \
 ])
diff --git a/src/openvpn/console_builtin.c b/src/openvpn/console_builtin.c
index 9c8d72a..10369283 100644
--- a/src/openvpn/console_builtin.c
+++ b/src/openvpn/console_builtin.c
@@ -37,7 +37,7 @@ 
 #include "buffer.h"
 #include "misc.h"
 
-#ifdef HAVE_TERMIOS_H
+#ifndef _WIN32
 #include <termios.h>
 #endif
 
@@ -134,10 +134,7 @@ 
     return false;
 }
 
-#endif /* _WIN32 */
-
-
-#ifdef HAVE_TERMIOS_H
+#else
 
 /**
  * Open the current console TTY for read/write operations
@@ -176,7 +173,7 @@ 
     }
 }
 
-#endif /* HAVE_TERMIOS_H */
+#endif
 
 
 /**
@@ -197,10 +194,8 @@ 
     ASSERT(capacity > 0);
     input[0] = '\0';
 
-#if defined(_WIN32)
+#ifdef _WIN32
     return get_console_input_win32(prompt, echo, input, capacity);
-#elif !defined(HAVE_TERMIOS_H)
-    msg(M_FATAL, "Sorry, but I can't get console input on this OS (%s)", prompt);
 #else
     bool restore_tty = false;
     bool ret = false;
@@ -261,7 +256,7 @@ 
 
     close_tty(fp);
     return ret;
-#endif /* if defined(_WIN32) */
+#endif
 }
 
 /**