From 1d23582bc8288f04cd8d38025d1486b83ffc3d93 Mon Sep 17 00:00:00 2001 From: "John Ankarstr\\xf6m" Date: Mon, 31 May 2021 22:13:21 +0200 Subject: Fix bug when multiple screen sessions attached The timeout would be too short to catch all of their respective terminal's responses. --- safetitle.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/safetitle.c b/safetitle.c index 7c24ab2..e5adac3 100644 --- a/safetitle.c +++ b/safetitle.c @@ -33,7 +33,7 @@ da(int fd, char *buf, int real) FD_ZERO(&fds); FD_SET(fd, &fds); timeout.tv_sec = 0; - timeout.tv_usec = 0; + timeout.tv_usec = 1; responses = 0; i = 0; @@ -94,7 +94,7 @@ main(int argc, char *argv[]) tcgetattr(ttyfd, &restore); tcgetattr(ttyfd, &term); term.c_lflag &= ~(ICANON|ECHO); - tcsetattr(ttyfd, TCSAFLUSH, &term); + tcsetattr(ttyfd, TCSANOW, &term); /* get device attributes for real terminal */ if(da(ttyfd, buf, 0)==-1){ @@ -117,7 +117,7 @@ main(int argc, char *argv[]) r = 0; end: - tcsetattr(ttyfd, TCSAFLUSH, &restore); + tcsetattr(ttyfd, TCSANOW, &restore); return r; usage: fprintf(stderr, "usage: %s [-d] title\n", argv[0]); -- cgit v1.2.3