From: erickson Date: Mon, 7 Nov 2005 21:03:05 +0000 (+0000) Subject: handling 'hostname' more carefully X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=1a47fb77a9d062bdfe479f9bd9345260ef09301c;p=opensrf%2Fbjwebb.git handling 'hostname' more carefully git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@572 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/libstack/osrf_system.c b/src/libstack/osrf_system.c index 419bdac..56ba6e8 100644 --- a/src/libstack/osrf_system.c +++ b/src/libstack/osrf_system.c @@ -3,6 +3,8 @@ #include "osrf_application.h" #include "osrf_prefork.h" +char* __osrfSystemHostname = NULL; + void __osrfSystemSignalHandler( int sig ); transport_client* __osrfGlobalTransportClient; @@ -56,7 +58,9 @@ int _osrfSystemInitCache() { int osrfSystemBootstrap( char* hostname, char* configfile, char* contextNode ) { - if( !(configfile && contextNode) ) return -1; + if( !(hostname && configfile && contextNode) ) return -1; + + __osrfSystemHostname = strdup(hostname); /* first we grab the settings */ if(!osrfSystemBootstrapClientResc(configfile, contextNode, "settings_grabber" )) { @@ -167,7 +171,10 @@ int osrf_system_bootstrap_client_resc( char* config_file, char* contextnode, cha transport_client* client = client_init( domain, iport, unixpath, 0 ); - char* host = getenv("HOSTNAME"); + char* host; + if(__osrfSystemHostname) host = __osrfSystemHostname; + else host = getenv("HOSTNAME"); + if( host == NULL ) = ""; if(!resource) resource = ""; int len = strlen(resource) + 256;