summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2007-10-19 14:37:03 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2007-10-19 14:37:03 +0200
commit1e4c80799fd17b1b0841d7108ee752b685f72dba (patch)
tree91db4353fcb14430aab20ee7f65263d52468f82b
parenteeaa969186650ed419404a76453140a9c91f47d1 (diff)
downloadvdr-1e4c80799fd17b1b0841d7108ee752b685f72dba.tar.gz
vdr-1e4c80799fd17b1b0841d7108ee752b685f72dba.tar.bz2
Improved shutdown handling
-rw-r--r--CONTRIBUTORS1
-rw-r--r--HISTORY1
-rw-r--r--shutdown.c13
-rw-r--r--thread.c4
4 files changed, 14 insertions, 5 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 99b49272..2989cbf9 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -1536,6 +1536,7 @@ Udo Richter <udo_richter@gmx.de>
for adding a missing error report to cCuttingThread::Action()
for reporting a problem in handling reallocated memory in cCharSetConv::Convert()
for fixing a new[]/delete mismatch in cMenuEditStrItem::LeaveEditMode()
+ for improving shutdown handling
Sven Kreiensen <svenk@kammer.uni-hannover.de>
for his help in keeping 'channels.conf.terr' up to date
diff --git a/HISTORY b/HISTORY
index 81441c4a..25e5d040 100644
--- a/HISTORY
+++ b/HISTORY
@@ -5497,3 +5497,4 @@ Video Disk Recorder Revision History
- Updated the Italian OSD texts (thanks to Diego Pierotto).
- The "Play" key now starts replay of the selected recording in the Recordings
menu (thanks to Ville Skyttä);
+- Improved shutdown handling (thanks to Udo Richter).
diff --git a/shutdown.c b/shutdown.c
index 4029a78c..4fde5440 100644
--- a/shutdown.c
+++ b/shutdown.c
@@ -6,7 +6,7 @@
*
* Original version written by Udo Richter <udo_richter@gmx.de>.
*
- * $Id: shutdown.c 1.1 2007/02/24 17:24:11 kls Exp $
+ * $Id: shutdown.c 1.2 2007/10/19 14:33:40 kls Exp $
*/
#include "shutdown.h"
@@ -110,9 +110,11 @@ void cShutdownHandler::CheckManualStart(int ManualStart)
// Set inactive after MinUserInactivity
SetUserInactiveTimeout();
}
- else
+ else {
// Set inactive from now on
+ dsyslog("scheduled wakeup time in %ld minutes, assuming automatic start of VDR", Delta / 60);
SetUserInactive();
+ }
}
void cShutdownHandler::SetShutdownCommand(const char *ShutdownCommand)
@@ -126,8 +128,13 @@ void cShutdownHandler::CallShutdownCommand(time_t WakeupTime, int Channel, const
time_t Delta = WakeupTime ? WakeupTime - time(NULL) : 0;
cString cmd = cString::sprintf("%s %ld %ld %d \"%s\" %d", shutdownCommand, WakeupTime, Delta, Channel, *strescape(File, "\"$"), UserShutdown);
isyslog("executing '%s'", *cmd);
- if (SystemExec(cmd, true) == 0)
+ int Status = SystemExec(cmd, true);
+ if (!WIFEXITED(Status) || WEXITSTATUS(Status))
+ esyslog("SystemExec() failed with status %d", Status);
+ else {
Setup.NextWakeupTime = WakeupTime; // Remember this wakeup time for comparison on reboot
+ Setup.Save();
+ }
}
void cShutdownHandler::SetUserInactiveTimeout(int Seconds, bool Force)
diff --git a/thread.c b/thread.c
index a0647d0e..95831242 100644
--- a/thread.c
+++ b/thread.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: thread.c 1.62 2007/08/24 13:15:48 kls Exp $
+ * $Id: thread.c 1.63 2007/10/19 14:30:13 kls Exp $
*/
#include "thread.h"
@@ -518,7 +518,7 @@ int SystemExec(const char *Command, bool Detached)
if (Detached) {
// Fork again and let first child die - grandchild stays alive without parent
if (fork() > 0)
- exit(0);
+ _exit(0);
// Start a new session
pid_t sid = setsid();
if (sid < 0)