rem: close(msg_pipe[0]); close(msg_pipe[1]);
add: if (msg_pipe[0]!=-1) close(msg_pipe[0]); if (msg_pipe[1]!=-1) close(msg_pipe[1]);
context: void destroy_msg_queue(){	unsigned int  available;	str           buf;	struct peer   *p;	LOG(L_INFO,"INFO:destroy_msg_queue: max_queued_size  = %u bytes\n",			max_queued_size);	LOG(L_INFO,"INFO:destroy_msg_queue: max_queued_units = %u \n",			max_queued_units);	destroy_locks( msg_lock, 1);	/*empty the pipe */	while (ioctl(msg_pipe[0],FIONREAD,&available) &&	available>=sizeof(struct queue_unit) ) {		get_from_queue( &buf, &p);		DBG("DEBUG:destroy_msg_queue: dumping unused mesage from queue\n");		shm_free( buf.s );	}	close(msg_pipe[0]);	close(msg_pipe[1]);}