Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions psh/pshapp/auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static int psh_authcredentget(char *buff, int ispasswd, int maxinlen)
else
ttyattr.c_lflag |= (ICANON | ECHO | ISIG);

if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &ttyattr) < 0) {
if (tcsetattr(STDIN_FILENO, TCSADRAIN, &ttyattr) < 0) {
fprintf(stderr, "psh: setting tty attributes fail\n");
return -ENOTTY;
}
Expand Down Expand Up @@ -90,11 +90,11 @@ static int psh_authcredentget(char *buff, int ispasswd, int maxinlen)
if (ispasswd || inputlen < 0)
fprintf(stdout, "\n");

if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &origattr) < 0) {
if (tcsetattr(STDIN_FILENO, TCSADRAIN, &origattr) < 0) {
fprintf(stderr, "psh: setting tty attributes fail\n");
return -ENOTTY;
}

if (inputlen >= 0)
return inputlen;

Expand Down
6 changes: 3 additions & 3 deletions psh/pshapp/pshapp.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ static int psh_readcmd(struct termios *orig, psh_hist_t *cmdhist, char **cmd)
/* Enable raw mode for command processing */
cfmakeraw(&raw);

if ((err = tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw)) < 0) {
if ((err = tcsetattr(STDIN_FILENO, TCSADRAIN, &raw)) < 0) {
fprintf(stderr, "\npsh: failed to enable raw mode\n");
free(*cmd);
return err;
Expand Down Expand Up @@ -1025,7 +1025,7 @@ static int psh_readcmd(struct termios *orig, psh_hist_t *cmdhist, char **cmd)
}

/* Restore original terminal settings */
if ((esc = tcsetattr(STDIN_FILENO, TCSAFLUSH, orig)) < 0) {
if ((esc = tcsetattr(STDIN_FILENO, TCSADRAIN, orig)) < 0) {
fprintf(stderr, "\r\npsh: failed to restore terminal settings\r\n");
if (err >= 0)
err = esc;
Expand Down Expand Up @@ -1452,7 +1452,7 @@ static int psh_reset(int argc, char **argv)
term.c_iflag |= IXON | BRKINT | PARMRK;
term.c_oflag |= OPOST;

if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &term) < 0) {
if (tcsetattr(STDIN_FILENO, TCSADRAIN, &term) < 0) {
fprintf(stderr, "reset: failed to set cooked mode\n");
return EXIT_FAILURE;
}
Expand Down
Loading