Skip to content

Commit 2484e65

Browse files
schwabecron2
authored andcommitted
Assume termios.h is available on all non Windows platforms
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 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>
1 parent 702d298 commit 2484e65

2 files changed

Lines changed: 6 additions & 11 deletions

File tree

‎configure.ac‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ AC_CHECK_HEADERS([ \
459459
sys/time.h sys/ioctl.h sys/stat.h \
460460
sys/mman.h sys/file.h sys/wait.h \
461461
libgen.h stropts.h \
462-
syslog.h pwd.h grp.h termios.h \
462+
syslog.h pwd.h grp.h \
463463
sys/sockio.h sys/uio.h \
464464
poll.h sys/epoll.h err.h \
465465
])

‎src/openvpn/console_builtin.c‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include "buffer.h"
3838
#include "misc.h"
3939

40-
#ifdef HAVE_TERMIOS_H
40+
#ifndef _WIN32
4141
#include <termios.h>
4242
#endif
4343

@@ -133,10 +133,7 @@ get_console_input_win32(const char *prompt, const bool echo, char *input, const
133133
return false;
134134
}
135135

136-
#endif /* _WIN32 */
137-
138-
139-
#ifdef HAVE_TERMIOS_H
136+
#else
140137

141138
/**
142139
* Open the current console TTY for read/write operations
@@ -175,7 +172,7 @@ close_tty(FILE *fp)
175172
}
176173
}
177174

178-
#endif /* HAVE_TERMIOS_H */
175+
#endif
179176

180177

181178
/**
@@ -196,10 +193,8 @@ get_console_input(const char *prompt, const bool echo, char *input, const int ca
196193
ASSERT(capacity > 0);
197194
input[0] = '\0';
198195

199-
#if defined(_WIN32)
196+
#ifdef _WIN32
200197
return get_console_input_win32(prompt, echo, input, capacity);
201-
#elif !defined(HAVE_TERMIOS_H)
202-
msg(M_FATAL, "Sorry, but I can't get console input on this OS (%s)", prompt);
203198
#else
204199
bool restore_tty = false;
205200
bool ret = false;
@@ -260,7 +255,7 @@ get_console_input(const char *prompt, const bool echo, char *input, const int ca
260255

261256
close_tty(fp);
262257
return ret;
263-
#endif /* if defined(_WIN32) */
258+
#endif
264259
}
265260

266261
/**

0 commit comments

Comments
 (0)