#include #include #include "test.h" #include "tests.h" static void run_badaccept(void) { int nfd; int pclfd; int pccfd; nfd = open("/dev/null",O_RDWR,0); printf("badaccept: non-open file descriptor\n"); sleep(1); ERROR_PIDCONN(PIDCONN_ACCEPT,0x7fffffff,0,EBADF); printf("badaccept: non-LISTEN descriptor\n"); sleep(1); ERROR_PIDCONN(PIDCONN_ACCEPT,nfd,0,EFTYPE); printf("badaccept: ACCEPT on connected active end\n"); sleep(1); SET_PIDCONN(pclfd,PIDCONN_LISTEN,0,0); SET_PIDCONN(pccfd,PIDCONN_CONNECT,0,getpid()); ERROR_PIDCONN(PIDCONN_ACCEPT,pccfd,0,EFTYPE); close(nfd); close(pclfd); close(pccfd); printf("badaccept: done\n"); } const TEST test_badaccept = { &run_badaccept };