Get rid of unnecessary barrier. Improve comment.
[pintos-anon] / grading / userprog / read-zero.c
1 #include <stdio.h>
2 #include <syscall.h>
3
4 int
5 main (void) 
6 {
7   int handle, byte_cnt;
8   char buf;
9   printf ("(read-zero) begin\n");
10
11   handle = open ("sample.txt");
12   if (handle < 2)
13     printf ("(read-zero) fail: open() returned %d\n", handle);
14
15   buf = 123;
16   byte_cnt = read (handle, &buf, 0);
17   if (byte_cnt != 0)
18     printf ("(read-zero) fail: read() returned %d instead of 0\n", byte_cnt);
19   else if (buf != 123)
20     printf ("(read-zero) fail: 0-byte read() modified buffer\n");
21   
22   printf ("(read-zero) end\n");
23   return 0;
24 }