00001 /* Try a 0-byte write, which should return 0 without writing 00002 anything. */ 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, byte_cnt; 00012 char buf; 00013 00014 CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); 00015 00016 buf = 123; 00017 byte_cnt = write (handle, &buf, 0); 00018 if (byte_cnt != 0) 00019 fail("write() returned %d instead of 0", byte_cnt); 00020 }