posix: Fix return status of pthread_cancel()

POSIX recommends ESRCH in case no thread exists for the specified
identifier.

Update #2713.
This commit is contained in:
Sebastian Huber
2016-05-13 14:59:31 +02:00
parent 33de2037f6
commit 94b1ba5aed
2 changed files with 3 additions and 3 deletions

View File

@@ -64,5 +64,5 @@ int pthread_cancel(
break;
}
return EINVAL;
return ESRCH;
}

View File

@@ -101,9 +101,9 @@ void *countTaskAsync(void *ignored)
sc = pthread_setcanceltype(12, &old);
fatal_posix_service_status( sc, EINVAL, "cancel type EINVAL" );
puts( "Init - pthread_cancel - bad ID - EINVAL" );
puts( "Init - pthread_cancel - bad ID - ESRCH" );
sc = pthread_cancel(0x100);
fatal_posix_service_status( sc, EINVAL, "cancel bad Id" );
fatal_posix_service_status( sc, ESRCH, "cancel bad Id" );
/* Start countTask deferred */
{