diff options
author | Thomas Adam <thomas@xteddy.org> | 2020-06-01 12:01:20 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2020-06-01 12:01:20 +0100 |
commit | 91e40de2da5124b1593c1c25462b8c9a36b8ebfd (patch) | |
tree | baae9e8fbba21c26851ca4f451105ac194a1d688 /client.c | |
parent | 5ef790a6c41f5b78d2e757612b75cb9142b9173f (diff) | |
parent | a54a88edd6fd893d4370feb9f9136e13096b891c (diff) |
Merge branch 'obsd-master'
Diffstat (limited to 'client.c')
-rw-r--r-- | client.c | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -386,6 +386,11 @@ client_main(struct event_base *base, int argc, char **argv, int flags, int feat) client_exec(client_execshell, client_execcmd); } + /* Restore streams to blocking. */ + setblocking(STDIN_FILENO, 1); + setblocking(STDOUT_FILENO, 1); + setblocking(STDERR_FILENO, 1); + /* Print the exit message, if any, and exit. */ if (client_attached) { if (client_exitreason != CLIENT_EXIT_NONE) @@ -394,18 +399,17 @@ client_main(struct event_base *base, int argc, char **argv, int flags, int feat) ppid = getppid(); if (client_exittype == MSG_DETACHKILL && ppid > 1) kill(ppid, SIGHUP); - } else if (client_flags & CLIENT_CONTROLCONTROL) { + } else if (client_flags & CLIENT_CONTROL) { if (client_exitreason != CLIENT_EXIT_NONE) printf("%%exit %s\n", client_exit_message()); else printf("%%exit\n"); - printf("\033\\"); - tcsetattr(STDOUT_FILENO, TCSAFLUSH, &saved_tio); + if (client_flags & CLIENT_CONTROLCONTROL) { + printf("\033\\"); + tcsetattr(STDOUT_FILENO, TCSAFLUSH, &saved_tio); + } } else if (client_exitreason != CLIENT_EXIT_NONE) fprintf(stderr, "%s\n", client_exit_message()); - setblocking(STDIN_FILENO, 1); - setblocking(STDOUT_FILENO, 1); - setblocking(STDERR_FILENO, 1); return (client_exitval); } |