1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## 19flowcontrol_lockup.dpatch by <hesso@pool.math.tu-berlin.de>
4
## DP: Make Flush() truly non-blocking by employing an extra select().
5
## DP: Thus D_userfd is assured to be in non-blocking mode on return
6
## DP: (even if the return was premature due to select() timing out),
7
## DP: so the SetTTY() call in FreeDisplay() doesn't have to be
8
## DP: safeguarded on its own.
10
## DP: Note - I'm not satisfied at all with this patch, but I consider
11
## DP: it an ugly but working kluge, meant only to stay around as long
12
## DP: as upstream hasn't come up with anything better.
15
diff -Naur screen-4.0.3.orig/display.c screen-4.0.3/display.c
16
--- screen-4.0.3.orig/display.c 2008-06-01 23:41:50.000000000 +0200
17
+++ screen-4.0.3/display.c 2008-06-01 23:44:57.000000000 +0200
27
@@ -3570,15 +3572,29 @@
31
- if (fcntl(D_userfd, F_SETFL, 0))
32
- debug1("Warning: BLOCK fcntl failed: %d\n", errno);
33
+ if (fcntl(D_userfd, F_SETFL, FNBLOCK))
34
+ debug1("Warning: NBLOCK fcntl failed: %d\n", errno);
41
+ register int wr = 0;
42
+ sO.tv_sec = 5; sO.tv_usec = 0;
46
+ FD_SET(D_userfd, &fd_s);
47
+ sR = select(D_userfd+1, NULL, &fd_s, NULL, &sO);
49
+ debug("Timeout while waiting for display write fd to unblock\n");
51
+ } else if (sR > 0) break;
53
wr = write(D_userfd, p, l);
57
+ if (errno == EINTR || errno == EAGAIN)
59
debug1("Writing to display: %d\n", errno);
61
@@ -3591,11 +3607,6 @@
65
- if (fcntl(D_userfd, F_SETFL, FNBLOCK))
66
- debug1("Warning: NBLOCK fcntl failed: %d\n", errno);