mirror of
https://github.com/reactos/reactos.git
synced 2025-06-19 00:25:46 +00:00
[MSVCRT]
* Use Wine's _pclose(). Fixes msvcrt:misc crash. CORE-8080 svn path=/trunk/; revision=64035
This commit is contained in:
parent
1b538306e3
commit
489a69fa41
1 changed files with 40 additions and 8 deletions
|
@ -21,6 +21,14 @@
|
||||||
int alloc_fd(HANDLE hand, int flag); //FIXME: Remove
|
int alloc_fd(HANDLE hand, int flag); //FIXME: Remove
|
||||||
unsigned split_oflags(unsigned oflags); //FIXME: Remove
|
unsigned split_oflags(unsigned oflags); //FIXME: Remove
|
||||||
|
|
||||||
|
#ifndef _UNICODE
|
||||||
|
static struct popen_handle {
|
||||||
|
FILE *f;
|
||||||
|
HANDLE proc;
|
||||||
|
} *popen_handles;
|
||||||
|
static DWORD popen_handles_size;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
@ -130,16 +138,40 @@ FILE *_tpopen (const _TCHAR *cm, const _TCHAR *md) /* program name, pipe mode */
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
int _pclose (FILE *pp)
|
int CDECL _pclose(FILE* file)
|
||||||
{
|
{
|
||||||
TRACE("_pclose(%x)",pp);
|
HANDLE h;
|
||||||
|
DWORD i;
|
||||||
|
|
||||||
fclose(pp);
|
if (!MSVCRT_CHECK_PMT(file != NULL)) return -1;
|
||||||
//if (!TerminateProcess(pp->_tmpfname ,0))
|
|
||||||
// return( -1 );
|
_mlock(_POPEN_LOCK);
|
||||||
return( 0 );
|
for(i=0; i<popen_handles_size; i++)
|
||||||
|
{
|
||||||
|
if (popen_handles[i].f == file)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(i == popen_handles_size)
|
||||||
|
{
|
||||||
|
_munlock(_POPEN_LOCK);
|
||||||
|
*_errno() = EBADF;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
h = popen_handles[i].proc;
|
||||||
|
popen_handles[i].f = NULL;
|
||||||
|
_munlock(_POPEN_LOCK);
|
||||||
|
|
||||||
|
fclose(file);
|
||||||
|
if(WaitForSingleObject(h, INFINITE)==WAIT_FAILED || !GetExitCodeProcess(h, &i))
|
||||||
|
{
|
||||||
|
_dosmaperr(GetLastError());
|
||||||
|
CloseHandle(h);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
CloseHandle(h);
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue