* bug-div0.c: raise SIGFPE manually since Darwin won't trap on 1/0.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
|
||||
int buf[1];
|
||||
|
||||
@@ -24,7 +25,10 @@ int main(void)
|
||||
int ch;
|
||||
|
||||
while((ch = getc(stdin)) != EOF)
|
||||
{
|
||||
buf[0] = 1 / !ch;
|
||||
if(ch) raise(SIGFPE); /* Needed on OS X... sigh. */
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user