<sys/socket.h>: turn off MSG_NOSIGNAL
[minix3.git] / test / test14.c
blobfc85cd5cd318f416895f1700ab4bf5ace47002d4
1 /* Test 14. unlinking an open file. */
3 #include <sys/types.h>
4 #include <errno.h>
5 #include <fcntl.h>
6 #include <stdlib.h>
7 #include <unistd.h>
8 #include <stdio.h>
10 #define TRIALS 100
11 int max_error = 4;
12 #include "common.h"
15 char name[20] = {"TMP14."};
16 int subtest = 1;
19 int main(void);
20 void quit(void);
22 int main()
24 int fd0, i, pid;
26 start(14);
28 pid = getpid();
29 sprintf(&name[6], "%x", pid);
31 for (i = 0; i < TRIALS; i++) {
32 if ( (fd0 = creat(name, 0777)) < 0) e(1);
33 if (write(fd0, name, 20) != 20) e(2);
34 if (unlink(name) != 0) e(3);
35 if (close(fd0) != 0) e(4);
38 fd0 = creat(name, 0777);
39 write(fd0, name, 20);
40 unlink(name);
41 quit();
42 return(-1); /* impossible */