You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2011/06/05 08:41:39 UTC
svn commit: r1131956 - /incubator/mesos/trunk/src/configurator.cpp
Author: benh
Date: Sun Jun 5 06:41:39 2011
New Revision: 1131956
URL: http://svn.apache.org/viewvc?rev=1131956&view=rev
Log:
Bug fix due to calling realpath with too small of a buffer. Was causing segfaults and malloc failures on Mac OS X (no perceived bug on Linux).
Modified:
incubator/mesos/trunk/src/configurator.cpp
Modified: incubator/mesos/trunk/src/configurator.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/configurator.cpp?rev=1131956&r1=1131955&r2=1131956&view=diff
==============================================================================
--- incubator/mesos/trunk/src/configurator.cpp (original)
+++ incubator/mesos/trunk/src/configurator.cpp Sun Jun 5 06:41:39 2011
@@ -81,8 +81,8 @@ void Configurator::loadConfigFileIfGiven
string confDir = "";
if (params.contains("conf"))
confDir = params["conf"];
- else if (params.contains("home")) // find conf dir relative to MESOS_HOME
- confDir = params["home"] + "/" + DEFAULT_CONFIG_DIR;
+// else if (params.contains("home")) // find conf dir relative to MESOS_HOME
+// confDir = params["home"] + "/" + DEFAULT_CONFIG_DIR;
if (confDir != "")
loadConfigFile(confDir + "/" + CONFIG_FILE_NAME, overwrite);
}
@@ -123,14 +123,13 @@ void Configurator::loadCommandLine(int a
char* copyOfArg0 = new char[lengthOfArg0 + 1];
strcpy(copyOfArg0, argv[0]);
// Get the directory name from it
- char* buf = new char[lengthOfArg0 + 1];
- if (realpath(dirname(copyOfArg0), buf) == 0) {
+ char path[PATH_MAX];
+ if (realpath(dirname(copyOfArg0), path) == 0) {
throw ConfigurationException(
- "Could not get directory containing argv[0] -- realpath failed");
+ "Could not get directory containing argv[0] -- realpath failed");
}
- params["home"] = buf;
+ params["home"] = path;
delete[] copyOfArg0;
- delete[] buf;
}
// Convert args 1 and above to STL strings