Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 16e2c3140fc2503a9e77cbb6f343a5a36ffb33e9
Ticket: 859820ffffffffffffffffffffffffffffffffff
tclsh84t crashes when opening pipe
User & Date: davygrvy on 2004-01-19 04:19:16
Changes

  1. icomment:
    Logged In: YES 
    user_id=7549
    
    This might work:
    
    diff -c -r1.39 tclWinPipe.c
    *** tclWinPipe.c24 Dec 2003 04:18:23 -00001.39
    --- tclWinPipe.c18 Jan 2004 21:17:24 -0000
    ***************
    *** 2485,2491 ****
          int *statPtr,
          int options)
      {
    !     ProcInfo *infoPtr, **prevPtrPtr;
          DWORD flags;
          Tcl_Pid result;
          DWORD ret, exitCode;
    --- 2485,2491 ----
          int *statPtr,
          int options)
      {
    !     ProcInfo *infoPtr = NULL, **nextPtrPtr;
          DWORD flags;
          Tcl_Pid result;
          DWORD ret, exitCode;
    ***************
    *** 2506,2515 ****
           */
      
          Tcl_MutexLock(&pipeMutex);
    !     prevPtrPtr = &procList;
    !     for (infoPtr = procList; infoPtr != NULL;
    !     prevPtrPtr = &infoPtr->nextPtr, infoPtr = infoPtr-
    >nextPtr) {
    !  if (infoPtr->hProcess == (HANDLE) pid) {
          break;
      }
          }
    --- 2506,2516 ----
           */
      
          Tcl_MutexLock(&pipeMutex);
    !     for (nextPtrPtr = &procList; (*nextPtrPtr) != NULL;
    !     nextPtrPtr = &((*nextPtrPtr)->nextPtr)) {
    ! if (((*nextPtrPtr)->nextPtr)->hProcess == (HANDLE) 
    pid) {
    !     infoPtr = (*nextPtrPtr)->nextPtr;
    !     *nextPtrPtr = infoPtr->nextPtr;
          break;
      }
          }
    ***************
    *** 2539,2544 ****
    --- 2540,2552 ----
          if (ret == WAIT_TIMEOUT) {
      *statPtr = 0;
      if (options & WNOHANG) {
    +     /*
    +      * Reinsert this ProcInfo* back on the linkedlist.
    +      */
    +     Tcl_MutexLock(&pipeMutex);
    +     infoPtr->nextPtr = procList;
    +     procList = infoPtr;
    +     Tcl_MutexUnlock(&pipeMutex);
          return 0;
      } else {
          result = 0;
    ***************
    *** 2605,2611 ****
           */
      
          CloseHandle(infoPtr->hProcess);
    -     *prevPtrPtr = infoPtr->nextPtr;
          ckfree((char*)infoPtr);
      
          return result;
    --- 2613,2618 ----
    
    
    
  2. login: "davygrvy"
  3. mimetype: "text/plain"
  4. username: "davygrvy"