Here is a bit of sample code to exploit the prob:
gcc -Wall -o testcase testcase.c
------------------------------8<-------------------------------
#include <stdio.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
void main(void)
{
int fd[2];
fd_set set;
char *invalid=NULL;
socketpair(AF_UNIX, SOCK_STREAM, 0, fd);
if(fork()) {
fprintf(stderr, "Waiting 5 seconds...\n");
close(fd[1]);
sleep(5);
fprintf(stderr, "BOOM!\n");
*invalid=0;
} else {
int i;
close(fd[0]);
/* this is me being nice :) */
i=0;
while (i<10) {
FD_ZERO(&set);
FD_SET(fd[1],&set);
fprintf(stderr, "Select returned %d\n", select(fd[1] + 1, &set, NULL, NULL, NULL));
i++;
}
}
}
------------------------------8<-------------------------------
--Perry
-- Perry Harrington Linux rules all OSes. APSoft () email: perry@apsoft.com Think Blue. /\- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/