aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarstr\xf6m <john@ankarstrom.se>2021-05-31 22:13:21 +0200
committerJohn Ankarstr\xf6m <john@ankarstrom.se>2021-05-31 22:13:21 +0200
commit1d23582bc8288f04cd8d38025d1486b83ffc3d93 (patch)
tree536e049795bca9ca5be42b4ed5e8952fbb178a41
parentd1f19f1657b24668ff5dc416c4a5b1a934a3dcae (diff)
downloadsafetitle-1d23582bc8288f04cd8d38025d1486b83ffc3d93.tar.gz
Fix bug when multiple screen sessions attached
The timeout would be too short to catch all of their respective terminal's responses.
-rw-r--r--safetitle.c6
1 files 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]);