[MPlayer-dev-eng] [HACK] make nohup mplayer/mencoder work

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Tue Dec 30 11:36:28 CET 2008


Hello,
it is quite a hack particularly since it introduces a race condition
(though strictly speaking one exists already in nohup.c anyway, so it
matter little IMO, which is also the reason I did the check this way).
Still, it makes nohup work with mencoder/mplayer so it might be worth it
anyway...

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: mencoder.c
===================================================================
--- mencoder.c	(revision 28207)
+++ mencoder.c	(working copy)
@@ -1009,7 +1009,8 @@
 signal(SIGINT,exit_sighandler);  // Interrupt from keyboard
 signal(SIGQUIT,exit_sighandler); // Quit from keyboard
 signal(SIGTERM,exit_sighandler); // kill
-signal(SIGHUP,exit_sighandler);  // broken terminal line
+if (signal(SIGHUP,exit_sighandler) == SIG_IGN)  // broken terminal line
+    signal(SIGHUP, SIG_IGN); // allow nohup to work as expected
 signal(SIGPIPE,exit_sighandler); // broken pipe
 
 timer_start=GetTimerMS();
Index: mplayer.c
===================================================================
--- mplayer.c	(revision 28207)
+++ mplayer.c	(working copy)
@@ -2899,7 +2933,8 @@
   //========= Catch terminate signals: ================
   // terminate requests:
   signal(SIGTERM,exit_sighandler); // kill
-  signal(SIGHUP,exit_sighandler);  // kill -HUP  /  xterm closed
+  if (signal(SIGHUP,exit_sighandler) == SIG_IGN)  // kill -HUP  /  xterm closed
+      signal(SIGHUP, SIG_IGN); // allow nohup to work as expected
 
   signal(SIGINT,exit_sighandler);  // Interrupt from keyboard
 


More information about the MPlayer-dev-eng mailing list