summaryrefslogtreecommitdiffstats
path: root/patches/procps-3.2.7/generic/10_top_stdineof.dpatch
blob: 2eb50b06ecfc15346479d4eb6664aacdf61451fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#! /bin/sh /usr/share/dpatch/dpatch-run
## 10_top_stdineof.dpatch by  <csmall@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Check for stdin eof if term closes #458986

@DPATCH@
diff -urNad procps-3.2.7~/top.c procps-3.2.7/top.c
--- procps-3.2.7~/top.c	2008-08-10 00:24:40.000000000 +1000
+++ procps-3.2.7/top.c	2008-08-10 10:09:49.000000000 +1000
@@ -3382,9 +3382,8 @@
          // check 1st, in case tv zeroed (by sig handler) before it got set
          rc = chin(0, &c, 1);
          if (rc <= 0) {
-            // EOF is pretty much a "can't happen" except for a kernel bug.
-            // We should quickly die via SIGHUP, and thus not spin here.
-            // if (rc == 0) end_pgm(0); /* EOF from terminal */
+            if (rc == 0) end_pgm(0); /* EOF from terminal, may happen if top
+                                      * erroneously gets detached from it. */
             fcntl(STDIN_FILENO, F_SETFL, file_flags);
             select(1, &fs, NULL, NULL, &tv);
             fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK|file_flags);