Ports: Don't return errno value as pointer in openssh port

This commit is contained in:
Sahan Fernando 2021-12-12 20:47:39 +11:00 committed by Idan Horowitz
parent 49ed168ced
commit 398f1ca842

View file

@ -14,7 +14,7 @@ index 974d67f0..3496eebe 100644
static char * static char *
ssh_askpass(char *askpass, const char *msg, const char *env_hint) ssh_askpass(char *askpass, const char *msg, const char *env_hint)
{ {
@@ -122,62 +126,33 @@ ssh_askpass(char *askpass, const char *msg, const char *env_hint) @@ -122,62 +126,35 @@ ssh_askpass(char *askpass, const char *msg, const char *env_hint)
char * char *
read_passphrase(const char *prompt, int flags) read_passphrase(const char *prompt, int flags)
{ {
@ -56,7 +56,8 @@ index 974d67f0..3496eebe 100644
+ struct termios no_echo = original; + struct termios no_echo = original;
+ no_echo.c_lflag &= ~ECHO; + no_echo.c_lflag &= ~ECHO;
+ if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &no_echo) < 0) { + if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &no_echo) < 0) {
+ return errno; + perror("Failed to turn off echo for passphrase");
+ exit(errno);
} }
- if ((flags & RP_USE_ASKPASS) && getenv("DISPLAY") == NULL) - if ((flags & RP_USE_ASKPASS) && getenv("DISPLAY") == NULL)
@ -79,7 +80,8 @@ index 974d67f0..3496eebe 100644
+ tcsetattr(STDIN_FILENO, TCSAFLUSH, &original); + tcsetattr(STDIN_FILENO, TCSAFLUSH, &original);
+ putchar('\n'); + putchar('\n');
+ if (ret < 0) { + if (ret < 0) {
+ return errno; + perror("Failed to read passphrase");
+ exit(errno);
} }
- if (readpassphrase(prompt, buf, sizeof buf, rppflags) == NULL) { - if (readpassphrase(prompt, buf, sizeof buf, rppflags) == NULL) {