[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #20495] debug version crashes on windows on close(-1)

From: Thomas Stuefe
Subject: [bug #20495] debug version crashes on windows on close(-1)
Date: Mon, 16 Jul 2007 07:49:08 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv: Gecko/20070515 Firefox/


                 Summary: debug version crashes on windows on close(-1)
                 Project: make
            Submitted by: tstuefe
            Submitted on: Monday 07/16/2007 at 07:49
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 3.81
        Operating System: MS Windows
           Fixed Release: None



I build gnumake and run it on windows. When executing a command ($(shell ..),
the command executes, but afterwards make crashes because the MS debug
C-Runtime detects a close(-1) and throws an error.

When debugging, I saw that the offending close was at 
      /* Close the write side of the pipe.  */
      (void) close (pipedes[1]);

pipedes[1] is -1, pipedes[0] is a valid file handle.

A workaround at this point would be a if(pipedes[1]!=-1) close(..)


When debugging further, I looked at the function "windows32_openpipe". What
happens is that the child process spawns fine, but the line 1490:
pipedes[1] = _open_osfhandle((long) hChildOutWr, O_APPEND);
sets pipedes[1] to -1.

I actually don't get this coding, but maybe its me. What I don't understand
is how the stdin to the child process is supposed to work at all. Parent
hands down its own duplicated stdin to the child 
(see line 1471, "hProcess = process_init_fd(hIn, hChildOutWr, 
and later on tries to get an OS handle for the write end of the child's
stdout pipe (line 1490)? 
As I said, maybe I simply don't get it. Microsoft's example for
stdio-redirection looks different:

"How to spawn console processes with redirected standard handles"

Best Regards,

Thomas Stuefe


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]