#include #include #include "test.h" #include "tests.h" static void run_badaccept(void) { int nfd; int pclfd; int pccfd; int pcafd; int pcc2fd; 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(pclfd); close(pccfd); printf("badaccept: ACCEPT on connected passive end\n"); sleep(1); SET_PIDCONN(pclfd,PIDCONN_LISTEN,0,0); SET_PIDCONN(pccfd,PIDCONN_CONNECT,0,getpid()); SET_PIDCONN(pcafd,PIDCONN_ACCEPT,pclfd,0); SET_PIDCONN(pcc2fd,PIDCONN_CONNECT,0,getpid()); ERROR_PIDCONN(PIDCONN_ACCEPT,pcafd,0,EFTYPE); close(pclfd); close(pccfd); close(pcafd); close(pcc2fd); close(nfd); printf("badaccept: done\n"); } const TEST test_badaccept = { &run_badaccept };