trynpbg1.c (505B)
1 #include <stddef.h> 2 #include <unistd.h> 3 #include "select.h" 4 #include "open.h" 5 #include "fifo.h" 6 7 #define FN "temp-trynpbg1.fifo" 8 9 int main(void) 10 { 11 int flagbug; 12 struct timeval instant; 13 fd_set rfds; 14 15 flagbug = 0; 16 if (fifo_make(FN,0600) != -1) { 17 close(0); 18 if (open_read(FN) == 0) { 19 FD_ZERO(&rfds); 20 FD_SET(0,&rfds); 21 instant.tv_sec = instant.tv_usec = 0; 22 if (select(1,&rfds,NULL,NULL,&instant) > 0) 23 flagbug = 1; 24 } 25 unlink(FN); 26 } 27 return !flagbug; 28 }