Now using cPipe instead of popen() in cCommand::Execute()

This commit is contained in:
Klaus Schmidinger 2007-01-26 13:38:32 +01:00
parent d1d5825136
commit cb25286394
3 changed files with 9 additions and 4 deletions

View File

@ -1114,6 +1114,8 @@ Reinhard Nissl <rnissl@gmx.de>
for changing the behaviour when hitting the end of a recording in fast forward mode for changing the behaviour when hitting the end of a recording in fast forward mode
for suggesting to give the cRemote::CallPlugin() function a boolean return value for suggesting to give the cRemote::CallPlugin() function a boolean return value
for fixing a possible crash in remux.c on 64-bit machines for fixing a possible crash in remux.c on 64-bit machines
for making cCommand::Execute() use cPipe instead of popen() to avoid problems
with open file handles when starting background commands
Richard Robson <richard_robson@beeb.net> Richard Robson <richard_robson@beeb.net>
for reporting freezing replay if a timer starts while in Transfer Mode from the for reporting freezing replay if a timer starts while in Transfer Mode from the

View File

@ -5085,6 +5085,9 @@ Video Disk Recorder Revision History
2007-01-26: Version 1.4.5-1 2007-01-26: Version 1.4.5-1
- Fixed i18n characters for the Hungarian texts (thanks to Thomas Günther). - Fixed i18n characters for the Hungarian texts (thanks to Thomas Günther).
- Now using cPipe instead of popen() in cCommand::Execute() to avoid problems
with open file handles when starting background commands (thanks to Reinhard
Nissl).
2007-01-26: Version 1.5.1 2007-01-26: Version 1.5.1

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: config.c 1.146 2006/07/22 11:57:51 kls Exp $ * $Id: config.c 1.147 2007/01/26 13:32:19 kls Exp $
*/ */
#include "config.h" #include "config.h"
@ -67,8 +67,8 @@ const char *cCommand::Execute(const char *Parameters)
asprintf(&cmdbuf, "%s %s", command, Parameters); asprintf(&cmdbuf, "%s %s", command, Parameters);
const char *cmd = cmdbuf ? cmdbuf : command; const char *cmd = cmdbuf ? cmdbuf : command;
dsyslog("executing command '%s'", cmd); dsyslog("executing command '%s'", cmd);
FILE *p = popen(cmd, "r"); cPipe p;
if (p) { if (p.Open(cmd, "r")) {
int l = 0; int l = 0;
int c; int c;
while ((c = fgetc(p)) != EOF) { while ((c = fgetc(p)) != EOF) {
@ -78,7 +78,7 @@ const char *cCommand::Execute(const char *Parameters)
} }
if (result) if (result)
result[l] = 0; result[l] = 0;
pclose(p); p.Close();
} }
else else
esyslog("ERROR: can't open pipe for command '%s'", cmd); esyslog("ERROR: can't open pipe for command '%s'", cmd);