rem: if (wait <= 0) {
add: if (wait < 0) {
context: Ns_DbPoolTimedGetMultipleHandles(Ns_DbHandle **handles, char *pool,     				 int nwant, int wait){    Handle    *handlePtr;    Handle   **handlesPtrPtr = (Handle **) handles;    Pool      *poolPtr;    Ns_Time    timeout, *timePtr;    int        i, ngot, status;    /*     * Verify the pool, the number of available handles in the pool,     * and that the calling thread does not already own handles from     * this pool.     */         poolPtr = GetPool(pool);    if (poolPtr == NULL) {	Ns_Log(Error, "dbinit: no such pool '%s'", pool);	return NS_ERROR;    }    if (poolPtr->nhandles < nwant) {	Ns_Log(Error, "dbinit: "	       "failed to get %d handles from a db pool of only %d handles: '%s'",	       nwant, poolPtr->nhandles, pool);	return NS_ERROR;    }    ngot = IncrCount(poolPtr, nwant);    if (ngot > 0) {	Ns_Log(Error, "dbinit: db handle limit exceeded: "	       "thread already owns %d handle%s from pool '%s'",	       ngot, ngot == 1 ? "" : "s", pool);	IncrCount(poolPtr, -nwant);	return NS_ERROR;    }        /*     * Wait until this thread can be the exclusive thread aquireing     * handles and then wait until all requested handles are available,     * watching for timeout in either of these waits.     */         if (wait <= 0) {	timePtr = NULL;    } else {    	Ns_GetTime(&timeout);    	Ns_IncrTime(&timeout, wait, 0);	timePtr = &timeout;    }    status = NS_OK;    Ns_MutexLock(&poolPtr->lock);    while (status == NS_OK && poolPtr->waiting) {	status = Ns_CondTimedWait(&poolPtr->waitCond, &poolPtr->lock, timePtr);    }    if (status == NS_OK) {    	poolPtr->waiting = 1;    	while (status == NS_OK && ngot < nwant) {	    while (status == NS_OK && poolPtr->firstPtr == NULL) {	    	status = Ns_CondTimedWait(&poolPtr->getCond, &poolPtr->lock,					  timePtr);	    }	    if (poolPtr->firstPtr != NULL) {		handlePtr = poolPtr->firstPtr;		poolPtr->firstPtr = handlePtr->nextPtr;		handlePtr->nextPtr = NULL;		if (poolPtr->lastPtr == handlePtr) {		    poolPtr->lastPtr = NULL;		}		handlesPtrPtr[ngot++] = handlePtr;	    }	}	poolPtr->waiting = 0;    	Ns_CondSignal(&poolPtr->waitCond);    }    Ns_MutexUnlock(&poolPtr->lock);    /*     * Handle special race condition where the final requested handle     * arrived just as the condition wait was timing out.     */    if (status == NS_TIMEOUT && ngot == nwant) {	status = NS_OK;    }    /*     * If status is still ok, connect any handles not already connected,     * otherwise return any allocated handles back to the pool, then     * update the final number of handles owned by this thread.     */    for (i = 0; status == NS_OK && i < ngot; ++i) {	handlePtr = handlesPtrPtr[i];	if (handlePtr->connected == NS_FALSE) {	    status = Connect(handlePtr);	}    }    if (status != NS_OK) {	Ns_MutexLock(&poolPtr->lock);	while (ngot > 0) {	    ReturnHandle(handlesPtrPtr[--ngot]);	}	if (poolPtr->waiting) {	    Ns_CondSignal(&poolPtr->getCond);	}	Ns_MutexUnlock(&poolPtr->lock);	IncrCount(poolPtr, -nwant);    }    return status;}