rem: char buf[256]; sprintf(buf, "no connection, FATAL %d!", rv);
add: char buf[SQL_BUF_LEN]; snprintf(buf, SQL_BUF_LEN, "no connection, FATAL %d!", rv);
context: static int begin_transaction(db_con_t * _h, char *_s){	PGresult *mr;	int rv;	/*	** Note:	**  The upper layers of code may attempt a transaction	**  before opening or having a valid connection to the	**  database.  We try to sense this, and open the database	**  if we have the sqlurl in the _h structure.  Otherwise,	**  all we can do is return an error.	*/	if(_h)	{		if(CON_CONNECTED(_h))		{			mr = PQexec(CON_CONNECTION(_h), "BEGIN");			if(!mr || PQresultStatus(mr) != PGRES_COMMAND_OK)			{				/*				** We get here if the connection to the				** db is corrupt, which can happen a few				** different ways, but all of them are				** related to the parent process forking,				** or being forked.				*/				PLOG("begin_transaction","corrupt connection");				CON_CONNECTED(_h) = 0;			}			else			{				/*				** this is the normal way out.				** the transaction ran fine.				*/				PQclear(mr);				return(0);			}		}		else		{			DLOG("begin_transaction", "called before db_init");		}		/*		** if we get here we have a corrupt db connection,		** but we probably have a valid db_con_t structure.		** attempt to open the db.		*/		if((rv = connect_db(_h, CON_SQLURL(_h))) != 0)		{			/*			** our attempt to fix the connection failed			*/			char buf[256];			sprintf(buf, "no connection, FATAL %d!", rv);			PLOG("begin_transaction",buf);			return(rv);		}	}	else	{		PLOG("begin_transaction","must call db_init first!");		return(-1);	}	/*	** we get here if the database connection was corrupt,	** i didn't want to use recursion ...	*/	mr = PQexec(CON_CONNECTION(_h), "BEGIN");	if(!mr || PQresultStatus(mr) != PGRES_COMMAND_OK)	{		char buf[256];		sprintf("FATAL %s, '%s'!\n",			PQerrorMessage(CON_CONNECTION(_h)), _s);		PLOG("begin_transaction", buf);		return(-1);	}	DLOG("begin_transaction", "db channel reset successful");	PQclear(mr);	return(0);}