00001 /* Reads from a file into a bad address. 00002 The process must be terminated with -1 exit code. */ 00003 00004 #include <syscall.h> 00005 #include "tests/lib.h" 00006 #include "tests/main.h" 00007 00008 void 00009 test_main (void) 00010 { 00011 int handle; 00012 00013 CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); 00014 read (handle, (char *) &handle - 4096, 1); 00015 fail ("survived reading data into bad address"); 00016 }