git clone https://orangeshoelaces.net/git/tttm.git
Author: Vasily Kolobkov on 06/04/2016
Committer: Vasily Kolobkov on 06/04/2016
Redirect sink's output to standard error
tttm.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tttm.c b/tttm.c
index 80105e5..e92097f 100644
--- a/tttm.c
+++ b/tttm.c
@@ -59,7 +59,7 @@ main(int argc, char **argv)
if (unlink(stortpl) == -1)
warn("failed to unlink temporary storage");
- if ((e = imap_init(&con, STDIN_FILENO, STDOUT_FILENO, page))) {
+ if ((e = imap_init(&con, 0, 1, page))) {
terr(e, "failed to initialize session");
}
if (con.state == IS_AUTH) {
@@ -231,7 +231,8 @@ sink_init(char **argv, pid_t *sid, int *sin)
close(w);
goto exit;
} else if (*sid == 0) {
- if (dup2(r, 0) == -1 || close(r) == -1 || close(w) == -1) {
+ if (dup2(2, 1) == -1 || dup2(r, 0) == -1 ||
+ close(r) == -1 || close(w) == -1) {
warn("failed to setup sink");
_exit(1);
}