summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2002-11-02 14:00:25 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2002-11-02 14:00:25 +0100
commit2e26a1d607b45bff095e93649d830cf7146be5f1 (patch)
tree7ad825c6248a78455b5a13540381f109ea32c2aa /thread.c
parentdd59830a92084c1ad597ea46dd4568381fe94511 (diff)
downloadvdr-2e26a1d607b45bff095e93649d830cf7146be5f1.tar.gz
vdr-2e26a1d607b45bff095e93649d830cf7146be5f1.tar.bz2
Fixed closing all dup'ed file descriptors in cPipe
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/thread.c b/thread.c
index 0f42e56c..c2068e0d 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.22 2002/08/15 11:44:48 kls Exp $
+ * $Id: thread.c 1.23 2002/11/02 14:00:25 kls Exp $
*/
#include "thread.h"
@@ -331,11 +331,9 @@ bool cPipe::Open(const char *Command, const char *Mode)
_exit(-1);
}
else {
- for (int i = 0; i <= fd[1]; i++) {
- if (i == STDIN_FILENO || i == STDOUT_FILENO || i == STDERR_FILENO)
- continue;
- close(i); // close all dup'ed filedescriptors
- }
+ int MaxPossibleFileDescriptors = getdtablesize();
+ for (int i = STDERR_FILENO + 1; i < MaxPossibleFileDescriptors; i++)
+ close(i); //close all dup'ed filedescriptors
if (execl("/bin/sh", "sh", "-c", Command, NULL) == -1) {
LOG_ERROR_STR(Command);
close(fd[1 - iopipe]);