summaryrefslogtreecommitdiffstats
path: root/generic/tclPipe.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclPipe.c')
-rw-r--r--generic/tclPipe.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/generic/tclPipe.c b/generic/tclPipe.c
index b02d91b..bd66ca6 100644
--- a/generic/tclPipe.c
+++ b/generic/tclPipe.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclPipe.c,v 1.17 2006/01/16 19:38:15 rmax Exp $
+ * RCS: @(#) $Id: tclPipe.c,v 1.18 2006/03/16 00:38:50 andreas_kupries Exp $
*/
#include "tclInt.h"
@@ -485,7 +485,7 @@ TclCreatePipeline(
int errorRelease = 0;
CONST char *p;
CONST char *nextArg;
- int skip, lastBar, lastArg, i, j, atOK, flags, errorToOutput = 0;
+ int skip, lastBar, lastArg, i, j, atOK, flags, needCmd, errorToOutput = 0;
Tcl_DString execBuffer;
TclFile pipeIn;
TclFile curInFile, curOutFile, curErrFile;
@@ -523,6 +523,7 @@ TclCreatePipeline(
lastBar = -1;
cmdCount = 1;
+ needCmd = 1;
for (i = 0; i < argc; i++) {
errorToOutput = 0;
skip = 0;
@@ -541,6 +542,7 @@ TclCreatePipeline(
}
lastBar = i;
cmdCount++;
+ needCmd = 1;
break;
case '<':
@@ -683,6 +685,11 @@ TclCreatePipeline(
}
}
break;
+
+ default:
+ /* Got a command word, not a redirection */
+ needCmd = 0;
+ break;
}
if (skip != 0) {
@@ -694,6 +701,15 @@ TclCreatePipeline(
}
}
+ if (needCmd) {
+ /* We had a bar followed only by redirections. */
+
+ Tcl_SetResult(interp,
+ "illegal use of | or |& in command",
+ TCL_STATIC);
+ goto error;
+ }
+
if (inputFile == NULL) {
if (inputLiteral != NULL) {
/*