rem: probe_run==1;
add: probe_run=1;
context: int lock_initialize(){	int i;#ifndef FAST_LOCK	int probe_run;#endif	/* first try allocating semaphore sets with fixed number of semaphores */	DBG("DEBUG: lock_initialize: lock initialization started\n");	timer_group_lock=shm_malloc(TG_NR*sizeof(ser_lock_t));	if (timer_group_lock==0){		LOG(L_CRIT, "ERROR: lock_initialize: out of shm mem\n");		goto error;	}#ifdef FAST_LOCK	for(i=0;i<TG_NR;i++) init_lock(timer_group_lock[i]);#else	/* transaction timers */	if ((timer_semaphore= init_semaphore_set( TG_NR ) ) < 0) {		LOG(L_CRIT, "ERROR: lock_initialize:  "			"transaction timer semaphore initialization failure: %s\n",				strerror(errno));		goto error;	}	for (i=0; i<TG_NR; i++) {		timer_group_lock[i].semaphore_set = timer_semaphore;		timer_group_lock[i].semaphore_index = timer_group[ i ];		}	i=SEM_MIN;	/* probing phase: 0=initial, 1=after the first failure */	probe_run=0;again:	do {		if (entry_semaphore>0) /* clean-up previous attempt */			semctl( entry_semaphore, 0 , IPC_RMID , 0 );		if (reply_semaphore>0)			semctl(reply_semaphore, 0 , IPC_RMID , 0 );#ifdef _OBSOLETED		if (ack_semaphore>0)			semctl(reply_semaphore, 0 , IPC_RMID , 0 );#endif#ifdef _XWAIT		if (wait_semaphore>0)			semctl(wait_semaphore, 0 , IPC_RMID , 0 );#endif		if (i==0){			LOG(L_CRIT, "lock_initialize: could not allocate semaphore"					" sets\n");			goto error;		}		entry_semaphore=init_semaphore_set( i );		if (entry_semaphore==-1) {			DBG("DEBUG: lock_initialize: entry semaphore "					"initialization failure:  %s\n", strerror( errno ) );			/* Solaris: EINVAL, Linux: ENOSPC */                        if (errno==EINVAL || errno==ENOSPC ) {                                /* first time: step back and try again */                                if (probe_run==0) {					DBG("DEBUG: lock_initialize: first time "								"semaphore allocation failure\n");                                        i--;                                        probe_run=1;                                        continue;				/* failure after we stepped back; give up */                                } else {				 	DBG("DEBUG: lock_initialize:   second time sempahore allocation failure\n");					goto error;				}                        }			/* some other error occured: give up */                        goto error;                }		/* allocation succeeded */		if (probe_run==1) { /* if ok after we stepped back, we're done */			break;		} else { /* if ok otherwiese, try again with larger set */			if (i==SEM_MAX) break;			else {				i++;				continue;			}		}	} while(1);	sem_nr=i;		if ((reply_semaphore=init_semaphore_set( sem_nr ))<0){		if (errno==EINVAL || errno==ENOSPC ) {			DBG("DEBUG:lock_initialize: reply semaphore initialization"				" failure: %s\n", strerror(errno));			probe_run==1;			i--;			goto again;		}else{			LOG(L_CRIT, "ERROR:lock_initialize: reply semaphore initialization"				" failure: %s\n", strerror(errno));			goto error;		}	}#ifdef _OBSOLETED		if ((ack_semaphore=init_semaphore_set(sem_nr))<0){		if (errno==EINVAL || errno==ENOSPC ) {			DBG( "DEBUG:lock_initialize: ack semaphore initialization"				" failure: %s\n", strerror(errno));			probe_run==1;			i--;			goto again;		}else{			LOG(L_CRIT, "ERROR:lock_initialize: ack semaphore initialization"				" failure: %s\n", strerror(errno));			goto error;		}	}#endif#ifdef _XWAIT	if ((wait_semaphore=init_semaphore_set(sem_nr))<0){		if (errno==EINVAL || errno==ENOSPC ) {			DBG( "DEBUG:lock_initialize: wait semaphore initialization"				" failure: %s\n", strerror(errno));			probe_run==1;			i--;			goto again;		}else{			LOG(L_CRIT, "ERROR:lock_initialize: wait semaphore initialization"				" failure: %s\n", strerror(errno));			goto error;		}	}#endif	/* return success */	LOG(L_INFO, "INFO: semaphore arrays of size %d allocated\n", sem_nr );#endif /* FAST_LOCK*/	return 0;error:	lock_cleanup();	return -1;}