FD_ZERO( &gptr->writefds );
FD_ZERO( &gptr->execpfds );
- for( tpptr = gptr->tplist; tpptr != NULL; tpptr = nextb ) {
- nextb = tpptr->next;
+ tpptr = gptr->tplist;
+ while( tpptr != NULL ) {
+ nextb = tpptr->next; // point past allowing for a delete
+
if( tpptr->flags & TPF_DELETE ) {
- SIterm( gptr, tpptr );
+ if( tpptr->fd >= 0 ) { // wasn't closed for some reason
+ SIterm( gptr, tpptr );
+ }
+ SIrm_tpb( gptr, tpptr ); // safe to remove the block from the list in this thread
} else {
if( tpptr->fd >= 0 ) { // if valid file descriptor
if( tpptr->fd >= gptr->fdcount ) {
}
}
}
+
+ tpptr = nextb;
}
}