Patch by Vasilis Kaoutsis: The Open Group Base Specs for signal() require

errno to be set to a positive value on error, but since BeOS error codes are
negative numbers, we can't comply. Changed the tests accordingly to check for
the expected error code (EINVAL) instead.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22845 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2007-11-06 22:06:40 +00:00
parent 5450cae172
commit def1a8a91c
2 changed files with 6 additions and 6 deletions
@@ -24,15 +24,15 @@ void myhandler(int signo)
int main() int main()
{ {
errno = -1; errno = 0;
if (signal(-1, myhandler) != SIG_ERR) { if (signal(-1, myhandler) != SIG_ERR) {
printf("Test FAILED: signal() didn't return SIG_ERR even though invalid signal number was passed to it\n"); printf("Test FAILED: signal() didn't return SIG_ERR even though invalid signal number was passed to it\n");
return PTS_FAIL; return PTS_FAIL;
} }
if (errno <= 0) { if (errno != EINVAL) {
printf("Test FAILED: errno wasn't set to a positive number even though invalid signal number was passed to the signal() function\n"); printf("Test FAILED: errno wasn't set to EINVAL even though invalid signal number was passed to the signal() function\n");
return PTS_FAIL; return PTS_FAIL;
} }
printf("signal(): Test passed\n"); printf("signal(): Test passed\n");
@@ -24,15 +24,15 @@ void myhandler(int signo)
int main() int main()
{ {
errno = -1; errno = 0;
if (signal(SIGKILL, myhandler) != SIG_ERR) { if (signal(SIGKILL, myhandler) != SIG_ERR) {
printf("Test FAILED: signal() didn't return SIG_ERR even though a non-catchable signal was passed to it\n"); printf("Test FAILED: signal() didn't return SIG_ERR even though a non-catchable signal was passed to it\n");
return PTS_FAIL; return PTS_FAIL;
} }
if (errno <= 0) { if (errno != EINVAL) {
printf("Test FAILED: errno wasn't set to a positive number even though a non-catchable signal was passed to the signal() function\n"); printf("Test FAILED: errno wasn't set to EINVAL even though a non-catchable signal was passed to the signal() function\n");
return PTS_FAIL; return PTS_FAIL;
} }
printf("signal(): Test passed\n"); printf("signal(): Test passed\n");