Fossil SCM
Wrong cast in call to _open_osfhandle
Fixed
6585b6c5d905821…
· opened 15 years, 2 months ago
- Type
- Code_Defect
- Priority
- —
- Severity
- Severe
- Resolution
- Fixed
- Subsystem
- —
- Created
- Jan. 14, 2011 1:59 p.m.
According to Microsoft, _open_osfhandle is declared as follows:
int _open_osfhandle (
intptr_t osfhandle,
int flags
);
However, Fossil currently calls this function as follow:
*pfdIn = _open_osfhandle((long)hStdoutRd, 0);
fd = _open_osfhandle((long)hStdinWr, 0);
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