diff options
Diffstat (limited to 'src/getpass.c')
-rw-r--r-- | src/getpass.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/getpass.c b/src/getpass.c index 99627665..6be33c77 100644 --- a/src/getpass.c +++ b/src/getpass.c @@ -44,7 +44,8 @@ * * @return 1 on success, 0 on error. */ -static int ssh_gets(const char *prompt, char *buf, size_t len, int verify) { +static int ssh_gets(const char *prompt, char *buf, size_t len, int verify) +{ char *tmp; char *ptr = NULL; int ok = 0; @@ -121,7 +122,8 @@ int ssh_getpass(const char *prompt, char *buf, size_t len, int echo, - int verify) { + int verify) +{ HANDLE h; DWORD mode = 0; int ok; @@ -213,7 +215,8 @@ int ssh_getpass(const char *prompt, char *buf, size_t len, int echo, - int verify) { + int verify) +{ struct termios attr; struct termios old_attr; int ok = 0; @@ -255,7 +258,11 @@ int ssh_getpass(const char *prompt, /* disable nonblocking I/O */ if (fd & O_NDELAY) { - fcntl(0, F_SETFL, fd & ~O_NDELAY); + ok = fcntl(0, F_SETFL, fd & ~O_NDELAY); + if (ok < 0) { + perror("fcntl"); + return -1; + } } ok = ssh_gets(prompt, buf, len, verify); @@ -267,7 +274,11 @@ int ssh_getpass(const char *prompt, /* close fd */ if (fd & O_NDELAY) { - fcntl(0, F_SETFL, fd); + ok = fcntl(0, F_SETFL, fd); + if (ok < 0) { + perror("fcntl"); + return -1; + } } if (!ok) { |