~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to tests/unistd/close.c

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
ImportĀ upstreamĀ versionĀ 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
#include <errno.h>
 
3
#include <unistd.h>
 
4
#include <fcntl.h>
 
5
 
 
6
int main() {
 
7
  int f = open("/", O_RDONLY);
 
8
 
 
9
  printf("fsync(opened): %d\n", fsync(f));
 
10
  printf("errno: %d\n", errno);
 
11
  errno = 0;
 
12
 
 
13
  printf("close(opened): %d\n", close(f));
 
14
  printf("errno: %d\n", errno);
 
15
  errno = 0;
 
16
 
 
17
  printf("fsync(closed): %d\n", fsync(f));
 
18
  printf("errno: %d\n", errno);
 
19
  errno = 0;
 
20
 
 
21
  printf("close(closed): %d\n", close(f));
 
22
  printf("errno: %d\n", errno);
 
23
  errno = 0;
 
24
 
 
25
  return 0;
 
26
}