Commit 5105cc30 authored by whitlocb's avatar whitlocb

Fix a fortran memory issue in Libsim and add -socket-bridge-host command line...

Fix a fortran memory issue in Libsim and add -socket-bridge-host command line argument support in socket bridge.

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@27612 18c085ea-50e0-402c-830e-de6fd14e8384
parent ae2b09a6
......@@ -217,6 +217,7 @@ LaunchService::SetupGatewaySocketBridgeIfNeeded(stringVector &launchArgs)
int portargument = -1;
int hostargument = -1;
int bufferSize = -1;
std::string sbHost;
for (size_t i=0; i<launchArgs.size(); i++)
{
if (i<launchArgs.size()-1 && launchArgs[i] == "-port")
......@@ -232,6 +233,10 @@ LaunchService::SetupGatewaySocketBridgeIfNeeded(stringVector &launchArgs)
{
bufferSize = SocketConnection::FIXED_BUFFER_SIZE;
}
else if((i+1)<launchArgs.size() && launchArgs[i] == "-socket-bridge-host")
{
sbHost = launchArgs[i+1];
}
}
bool setupBridge = (portargument != -1 && hostargument != -1);
......@@ -254,9 +259,14 @@ LaunchService::SetupGatewaySocketBridgeIfNeeded(stringVector &launchArgs)
<< " to tunneled port localhost/" << oldlocalport << endl;
// replace the host with my host name
char hostname[1024];
gethostname(hostname,1024);
launchArgs[hostargument] = hostname;
if(sbHost.empty())
{
char hostname[1024];
gethostname(hostname,1024);
launchArgs[hostargument] = hostname;
}
else
launchArgs[hostargument] = sbHost;
// replace the launch argument port number
char newportstr[10];
......
......@@ -26,6 +26,7 @@ enhancements and bug-fixes that were added to this release.</p>
<ul>
<li>The <i>VisItAddPlot()</i> function in Libsim was incorrectly using the global <i>"Apply operators to all plots"</i> setting when creating plots. The behavior for VisItAddPlot() has been changed so new plots are not created with previously applied operators to more closely match the operation of the VisIt CLI.</li>
<li>Large tecplot files could not be read on Windows.</li>
<li>A potential memory overwrite was fixed in the Fortran <i>visitgetenv</i> function in Libsim.</li>
<li>Fixed the bug with the missing QT4 include and archive files after doing a 'make install'</li>
<li>Re-enable Adaptive csg capability for Windows, which was inadvertently disabled for previous release.</li>
<li></li>
......@@ -34,7 +35,7 @@ enhancements and bug-fixes that were added to this release.</p>
<a name="Enhancements"></a>
<p><b><font size="4">Enhancements in version 2.10.1</font></b></p>
<ul>
<li></li>
<li>VisIt now permits the <i>-socket-bridge-host</i> command line argument to override the host name passed to compute engines when VCL starts a socket bridge. This is useful for login nodes that are attached to multiple network interfaces such as on BlueGene/Q where compute nodes may need to attach to the socket bridge host (typically the LAC node) using an alias.</li>
<li></li>
<li></li>
<li></li>
......
......@@ -412,26 +412,40 @@ F_VISITSETUPENV2(VISIT_F77STRING env, int *lenv)
* Date: Tue Jun 4 09:27:04 PDT 2013
*
* Modifications:
*
* Brad Whitlock, Tue Oct 27 11:01:11 PDT 2015
* Fixed potential memory issue.
*****************************************************************************/
#define FMINLENGTH(A,B) (((A) < (B)) ? (A) : (B))
FORTRAN
F_VISITGETENV(VISIT_F77STRING env, int *lenv)
{
char *src = VisItGetEnvironment();
if(src != NULL)
if(*lenv <= 0)
{
*lenv = 0;
return VISIT_ERROR;
}
else if(src != NULL)
{
size_t len, sz = 1; /// TODO: WARNING sz was uninitalized setting to 1 so the sz == 0 gets triggered if it needs to be (CHECK)
/* We have lenv which is the size of the destination buffer.
We have len which is the length of the string. */
size_t len, sz;
len = strlen(src);
sz = (len < *lenv) ? (sz - 1) : (*lenv - 1);
if(sz == 0)
*lenv = 0;
else
{
/* Fill the output buffer with NULL characters */
memset(env, 0, *lenv);
/* Copy the amount of string that will fit into the output buffer
(leaving 1 element for a NULL terminator).*/
sz = FMINLENGTH(len, *lenv-1);
if(sz > 0)
memcpy(env, src, sz);
env[sz] = '\0';
}
/* Return the length of the string in lenv */
*lenv = (int)sz;
}
else
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment