1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Added the backslash ('\') to the list of characters that need to be escaped when executing external commands

This commit is contained in:
Klaus Schmidinger 2008-02-24 10:30:49 +01:00
parent 088c325e8f
commit ce7b0c94f7
5 changed files with 10 additions and 6 deletions

View File

@ -1062,6 +1062,8 @@ Peter Bieringer <pb@bieringer.de>
for adding more error messages and line numbers when reading EPG data and info.vdr for adding more error messages and line numbers when reading EPG data and info.vdr
for fixing handling "more than 3 byte" key sequences in cKbdRemote::ReadKeySequence() for fixing handling "more than 3 byte" key sequences in cKbdRemote::ReadKeySequence()
for suggesting to ignore lines tagged with '#' in the 'info.vdr' file of a recording for suggesting to ignore lines tagged with '#' in the 'info.vdr' file of a recording
for reporting a problem with the backslash ('\') in parameters when executing
external commands
Alexander Damhuis <ad@phonedation.de> Alexander Damhuis <ad@phonedation.de>
for reporting problems when deleting a timer that is currently recording for reporting problems when deleting a timer that is currently recording

View File

@ -5668,3 +5668,5 @@ Video Disk Recorder Revision History
case a CAM menu is open). case a CAM menu is open).
- Increased the valid range of the "Subtitle offset" setup option to -100...100 - Increased the valid range of the "Subtitle offset" setup option to -100...100
(thanks to Rolf Ahrenberg). (thanks to Rolf Ahrenberg).
- Added the backslash ('\') to the list of characters that need to be escaped
when executing external commands (thanks to Peter Bieringer for reporting this one).

4
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: menu.c 1.479 2008/02/24 10:08:42 kls Exp $ * $Id: menu.c 1.480 2008/02/24 10:28:46 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -2127,7 +2127,7 @@ eOSState cMenuRecordings::Commands(eKeys Key)
cRecording *recording = GetRecording(ri); cRecording *recording = GetRecording(ri);
if (recording) { if (recording) {
cMenuCommands *menu; cMenuCommands *menu;
eOSState state = AddSubMenu(menu = new cMenuCommands(tr("Recording commands"), &RecordingCommands, cString::sprintf("\"%s\"", *strescape(recording->FileName(), "\"$")))); eOSState state = AddSubMenu(menu = new cMenuCommands(tr("Recording commands"), &RecordingCommands, cString::sprintf("\"%s\"", *strescape(recording->FileName(), "\\\"$"))));
if (Key != kNone) if (Key != kNone)
state = menu->ProcessKey(Key); state = menu->ProcessKey(Key);
return state; return state;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: recording.c 1.161 2008/02/16 13:31:39 kls Exp $ * $Id: recording.c 1.162 2008/02/24 10:28:53 kls Exp $
*/ */
#include "recording.h" #include "recording.h"
@ -1161,7 +1161,7 @@ const char *cRecordingUserCommand::command = NULL;
void cRecordingUserCommand::InvokeCommand(const char *State, const char *RecordingFileName) void cRecordingUserCommand::InvokeCommand(const char *State, const char *RecordingFileName)
{ {
if (command) { if (command) {
cString cmd = cString::sprintf("%s %s \"%s\"", command, State, *strescape(RecordingFileName, "\"$")); cString cmd = cString::sprintf("%s %s \"%s\"", command, State, *strescape(RecordingFileName, "\\\"$"));
isyslog("executing '%s'", *cmd); isyslog("executing '%s'", *cmd);
SystemExec(cmd); SystemExec(cmd);
} }

View File

@ -6,7 +6,7 @@
* *
* Original version written by Udo Richter <udo_richter@gmx.de>. * Original version written by Udo Richter <udo_richter@gmx.de>.
* *
* $Id: shutdown.c 1.4 2008/01/13 14:27:29 kls Exp $ * $Id: shutdown.c 1.5 2008/02/24 10:29:00 kls Exp $
*/ */
#include "shutdown.h" #include "shutdown.h"
@ -130,7 +130,7 @@ void cShutdownHandler::SetShutdownCommand(const char *ShutdownCommand)
void cShutdownHandler::CallShutdownCommand(time_t WakeupTime, int Channel, const char *File, bool UserShutdown) void cShutdownHandler::CallShutdownCommand(time_t WakeupTime, int Channel, const char *File, bool UserShutdown)
{ {
time_t Delta = WakeupTime ? WakeupTime - time(NULL) : 0; 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); cString cmd = cString::sprintf("%s %ld %ld %d \"%s\" %d", shutdownCommand, WakeupTime, Delta, Channel, *strescape(File, "\\\"$"), UserShutdown);
isyslog("executing '%s'", *cmd); isyslog("executing '%s'", *cmd);
int Status = SystemExec(cmd, true); int Status = SystemExec(cmd, true);
if (!WIFEXITED(Status) || WEXITSTATUS(Status)) if (!WIFEXITED(Status) || WEXITSTATUS(Status))