aboutsummaryrefslogtreecommitdiff
path: root/examples/tty_conv.c
diff options
context:
space:
mode:
authorSam Hartman <hartmans@debian.org>2024-12-02 09:55:34 -0700
committerSam Hartman <hartmans@debian.org>2024-12-02 09:55:34 -0700
commit7c9fb6472dcfae34ddbf4fbc9ecfafae2cf173c3 (patch)
treeb04aa8c3b2354427cbba730ccc832249f7244985 /examples/tty_conv.c
parente9aa2ef52a423a3a33299bf7e8715eb5bd76ea67 (diff)
parentea980d991196df67cdd56b3f65d210b73218d08a (diff)
downloadpam-7c9fb6472dcfae34ddbf4fbc9ecfafae2cf173c3.tar.gz
pam-7c9fb6472dcfae34ddbf4fbc9ecfafae2cf173c3.tar.bz2
pam-7c9fb6472dcfae34ddbf4fbc9ecfafae2cf173c3.zip
New upstream version 1.7.0
Diffstat (limited to 'examples/tty_conv.c')
-rw-r--r--examples/tty_conv.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/tty_conv.c b/examples/tty_conv.c
index 23f0684c..59bbb3b3 100644
--- a/examples/tty_conv.c
+++ b/examples/tty_conv.c
@@ -6,8 +6,9 @@
#include <string.h>
#include <errno.h>
#include <unistd.h>
-#include <termio.h>
+#include <termios.h>
#include <security/pam_appl.h>
+#include <sys/ioctl.h>
/***************************************
* @brief echo off/on
@@ -16,7 +17,7 @@
***************************************/
static void echoOff(int fd, int off)
{
- struct termio tty;
+ struct termios tty;
if (ioctl(fd, TCGETA, &tty) < 0)
{
fprintf(stderr, "TCGETA failed: %s\n", strerror(errno));
@@ -67,7 +68,7 @@ static char *readline(void)
int i;
flockfile(stdin);
- for (i = 0; i < PAM_MAX_RESP_SIZE; i++)
+ for (i = 0; i < PAM_MAX_RESP_SIZE - 1; i++)
{
int ch = getchar_unlocked();
if (ch == '\n' || ch == '\r' ||ch == EOF)