Drop main() prototype. Syncs with NetBSD-8
[minix.git] / minix / tests / t67b.c
blobccdebd5ceab4107602d4ef43510bdb747bd298d2
1 #include <sys/types.h>
2 #include <sys/wait.h>
3 #include <errno.h>
4 #include <fcntl.h>
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <unistd.h>
9 int
10 main(int argc, char *argv[])
12 int fd, fd_parent;
13 char buf[1];
15 if (argc != 2) {
16 return 1;
19 fd_parent = atoi(argv[1]);
21 /* Writing to fd_parent should fail as it has to be closed at this
22 * point */
23 if (write(fd_parent, buf, sizeof(buf)) != -1) {
24 return 2;
26 if (errno != EBADF) {
27 return 3;
30 /* If we open a new file, the fd we obtain should be identical to
31 * fd_parent */
32 fd = open("open_identical_fd", O_CREAT|O_RDWR, 0660);
33 if (fd != fd_parent) {
34 return 4;
37 return 0;