summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixChan.c
diff options
context:
space:
mode:
authorandreas_kupries <andreas_kupries@noemail.net>2002-02-04 23:51:58 (GMT)
committerandreas_kupries <andreas_kupries@noemail.net>2002-02-04 23:51:58 (GMT)
commitebf6618f047a5ff023bc698edc77f18fbf7af1b2 (patch)
treef1ad93beb139106d9e926d1772e8004af2f8786f /unix/tclUnixChan.c
parent1482e885089a6b4a09d9f6afc20ad0c033f45f66 (diff)
downloadtcl-ebf6618f047a5ff023bc698edc77f18fbf7af1b2.zip
tcl-ebf6618f047a5ff023bc698edc77f18fbf7af1b2.tar.gz
tcl-ebf6618f047a5ff023bc698edc77f18fbf7af1b2.tar.bz2
* unix/tclUnixChan.c (FileOutputProc): Fixed [bug 465765] reported
by Dale Talcott <daletalcott@users.sourceforge.net>. Avoid to write nothing into a file as STREAM based implementations will consider this a EOF (if the file is a pipe). Not done in the generic layer as this type of writing is actually useful to check the state of a socket. FossilOrigin-Name: 6e2600e273de8b16227685852ec889945fbd61f5
Diffstat (limited to 'unix/tclUnixChan.c')
-rw-r--r--unix/tclUnixChan.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c
index 6386bd5..aa11fcf 100644
--- a/unix/tclUnixChan.c
+++ b/unix/tclUnixChan.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: tclUnixChan.c,v 1.27 2002/01/23 20:46:01 dgp Exp $
+ * RCS: @(#) $Id: tclUnixChan.c,v 1.28 2002/02/04 23:51:59 andreas_kupries Exp $
*/
#include "tclInt.h" /* Internal definitions for Tcl. */
@@ -429,6 +429,16 @@ FileOutputProc(instanceData, buf, toWrite, errorCodePtr)
int written;
*errorCodePtr = 0;
+
+ if (toWrite == 0) {
+ /* SF Tcl Bug 465765.
+ * Do not try to write nothing into a file. STREAM based
+ * implementations will considers this as EOF (if there is a
+ * pipe behind the file).
+ */
+
+ return 0;
+ }
written = write(fsPtr->fd, buf, (size_t) toWrite);
if (written > -1) {
return written;