00001 /* Opens a directory, then tries to write to it, which must 00002 fail. */ 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 fd; 00012 int retval; 00013 00014 CHECK (mkdir ("xyzzy"), "mkdir \"xyzzy\""); 00015 CHECK ((fd = open ("xyzzy")) > 1, "open \"xyzzy\""); 00016 00017 msg ("write \"xyzzy\""); 00018 retval = write (fd, "foobar", 6); 00019 CHECK (retval == -1, 00020 "write \"xyzzy\" (must return -1, actually %d)", retval); 00021 }