According to Microsoft, _open_osfhandle is declared as follows:

<verbatim>
  int _open_osfhandle (
    intptr_t osfhandle,
    int flags
  );
</verbatim>

However, Fossil currently calls this function as follow:

<verbatim>
    *pfdIn = _open_osfhandle((long)hStdoutRd, 0);
    fd = _open_osfhandle((long)hStdinWr, 0);
</verbatim>

The cast to long is causing trouble, because on x86_64-windows,
long is still 32bit, whereas intptr_t is 64bit.

The attached patch fixes this.

-- tsbg