summaryrefslogtreecommitdiffstats
path: root/generic/tclPipe.c
diff options
context:
space:
mode:
authorandreas_kupries <akupries@shaw.ca>2006-03-16 00:35:53 (GMT)
committerandreas_kupries <akupries@shaw.ca>2006-03-16 00:35:53 (GMT)
commit87c9ed6e567dfddf056590c104ffe303a3ace5b7 (patch)
tree13f6d641812e9004d516f8059ad9c57f289bf2ee /generic/tclPipe.c
parente8db060adb7f6b18464bedc29e9872d54ea7854e (diff)
downloadtcl-87c9ed6e567dfddf056590c104ffe303a3ace5b7.zip
tcl-87c9ed6e567dfddf056590c104ffe303a3ace5b7.tar.gz
tcl-87c9ed6e567dfddf056590c104ffe303a3ace5b7.tar.bz2
* tests/socket.test: Extended the timeout in socket-11.11 from 10
to 40 seconds to allow for really slow machines. Also extended actual/expected results with value of variable 'done' to make it clearer when a test fails due to a timeout. [Bug 792159]. * generic/tclPipe.c (TclCreatePipeline): Modified the processing of pipebars to fail if the last bar is followed only by redirections. [Bug 768659].
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 accfd62..c1097ca 100644
--- a/generic/tclPipe.c
+++ b/generic/tclPipe.c
@@ -10,7 +10,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.7.2.4 2006/01/16 19:31:18 rmax Exp $
+ * RCS: @(#) $Id: tclPipe.c,v 1.7.2.5 2006/03/16 00:35:58 andreas_kupries Exp $
*/
#include "tclInt.h"
@@ -508,7 +508,7 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
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;
@@ -546,6 +546,7 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
lastBar = -1;
cmdCount = 1;
+ needCmd = 1;
for (i = 0; i < argc; i++) {
errorToOutput = 0;
skip = 0;
@@ -565,6 +566,7 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
}
lastBar = i;
cmdCount++;
+ needCmd = 1;
break;
case '<':
@@ -706,6 +708,11 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
}
}
break;
+
+ default:
+ /* Got a command word, not a redirection */
+ needCmd = 0;
+ break;
}
if (skip != 0) {
@@ -717,6 +724,15 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr,
}
}
+ 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) {
/*