procps/bug-634840.patch

21 lines
950 B
Diff

Do not setup SIGHUP signal handler if we are in the batch mode
Top enables a signal handler for the SIGHUP signal (loss of terminal). While
this makes sense for top's default interactive mode, it doesn't make any sense
for batch mode. If you run top in nohup just to collect data over time and
disconnect top finishes which is not what one would expect.
Index: procps-3.2.8/top.c
===================================================================
--- procps-3.2.8/top.c
+++ procps-3.2.8/top.c 2010-09-20 12:26:57.024458172 +0200
@@ -3445,7 +3445,8 @@ int main (int dont_care_argc, char *argv
windows_stage2(); // as bottom slice
// +-------------+
signal(SIGALRM, end_pgm);
- signal(SIGHUP, end_pgm);
+ if (!Batch)
+ signal(SIGHUP, end_pgm);
signal(SIGINT, end_pgm);
signal(SIGPIPE, end_pgm);
signal(SIGQUIT, end_pgm);