msvcrt: Make _beginthread() error out as documented.
msvcrt_set_errno() seems to be doing the right thing in case of too many threads, invalid parameters, etc. Signed-off-by: Arkadiusz Hiler <ahiler@codeweavers.com> Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
af2b2d0433
commit
80678c4395
|
@ -118,6 +118,8 @@ uintptr_t CDECL _beginthread(
|
||||||
|
|
||||||
TRACE("(%p, %d, %p)\n", start_address, stack_size, arglist);
|
TRACE("(%p, %d, %p)\n", start_address, stack_size, arglist);
|
||||||
|
|
||||||
|
if (!MSVCRT_CHECK_PMT(start_address)) return -1;
|
||||||
|
|
||||||
trampoline = malloc(sizeof(*trampoline));
|
trampoline = malloc(sizeof(*trampoline));
|
||||||
if(!trampoline) {
|
if(!trampoline) {
|
||||||
*_errno() = EAGAIN;
|
*_errno() = EAGAIN;
|
||||||
|
@ -128,7 +130,7 @@ uintptr_t CDECL _beginthread(
|
||||||
trampoline, CREATE_SUSPENDED, NULL);
|
trampoline, CREATE_SUSPENDED, NULL);
|
||||||
if(!thread) {
|
if(!thread) {
|
||||||
free(trampoline);
|
free(trampoline);
|
||||||
*_errno() = EAGAIN;
|
msvcrt_set_errno(GetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue