f029fe5dfb3f33bb02cb1ded0e9c0acff5049587
[pintos-anon] / grading / userprog / open-twice.c
1 #include <stdio.h>
2 #include <syscall.h>
3
4 int
5 main (void) 
6 {
7   int h1, h2;
8   printf ("(open-twice) begin\n");
9
10   h1 = open ("sample.txt");
11   if (h1 < 2)
12     printf ("(open-twice) fail: open() returned %d first time\n", h1);
13
14   h2 = open ("sample.txt");
15   if (h2 < 2)
16     printf ("(open-twice) fail: open() returned %d second time\n", h2);
17   if (h1 == h2)
18     printf ("(open-twice) fail: open() returned %d both times\n", h1);
19
20   printf ("(open-twice) end\n");
21   return 0;
22 }