xref: /relibc/tests/fcntl/create.c (revision ed19381547d66b76981ea1e4ff942c5a4da45ab7)
1 #include <fcntl.h>
2 #include <stdlib.h>
3 #include <unistd.h>
4 
5 #include "test_helpers.h"
6 
7 int main(void) {
8     int fd = creat("create.out", 0755);
9     ERROR_IF(creat, fd, == -1);
10     UNEXP_IF(creat, fd, < 0);
11 
12     int written = write(fd, "Hello World!\n", 13);
13     ERROR_IF(write, written, == -1);
14 
15     int c = close(fd);
16     ERROR_IF(close, c, == -1);
17     UNEXP_IF(close, c, != 0);
18 }
19