Posted to tcl by avl at Tue Apr 11 00:16:04 GMT 2017view raw

  1. Index: generic/tclIO.c
  2. ==================================================================
  3. --- generic/tclIO.c
  4. +++ generic/tclIO.c
  5. @@ -8874,12 +8874,12 @@
  6. ChannelState *statePtr; /* State info for channel */
  7. Tcl_Channel chan; /* The opaque type for the channel. */
  8. const char *chanName;
  9. int modeIndex; /* Index of mode argument. */
  10. int mask;
  11. - static const char *const modeOptions[] = {"readable", "writable", NULL};
  12. - static const int maskArray[] = {TCL_READABLE, TCL_WRITABLE};
  13. + static const char *const modeOptions[] = {"readable", "writable", "exception", NULL};
  14. + static const int maskArray[] = {TCL_READABLE, TCL_WRITABLE, TCL_EXCEPTION };
  15.  
  16. if ((objc != 3) && (objc != 4)) {
  17. Tcl_WrongNumArgs(interp, 1, objv, "channelId event ?script?");
  18. return TCL_ERROR;
  19. }
  20. @@ -8894,11 +8894,11 @@
  21. if (chan == NULL) {
  22. return TCL_ERROR;
  23. }
  24. chanPtr = (Channel *) chan;
  25. statePtr = chanPtr->state;
  26. - if ((statePtr->flags & mask) == 0) {
  27. + if ( ((statePtr->flags | TCL_EXCEPTION) & mask) == 0) {
  28. Tcl_SetObjResult(interp, Tcl_ObjPrintf("channel is not %s",
  29. (mask == TCL_READABLE) ? "readable" : "writable"));
  30. return TCL_ERROR;
  31. }
  32.  
  33.  
  34.