Skip to content

Commit 6501ffb

Browse files
committed
g++ is more strict (no initialization of string to NULL -- since it cannot dereference)
1 parent 925f6e1 commit 6501ffb

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

argparser.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,10 @@ bool ArgParser::initPlatformDir() {
194194
if (!found) { // try via PATH search
195195
logMsg("initPlatformDir: trying to find executable on PATH");
196196
std::string location = findOnPath(platformDir.c_str());
197-
strncpy(path, location.c_str(), PATH_MAX);
198-
found = true;
197+
if (location.size() > 0) {
198+
strncpy(path, location.c_str(), PATH_MAX);
199+
found = true;
200+
}
199201
}
200202

201203
// Check if bin/jruby file exists; this logs a message if not found

utilsfuncs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ string findOnPath(const char* name) {
144144

145145
start = sep + 1;
146146
}
147-
return NULL;
147+
return "";
148148
}
149149

150150
const char* getSysError(char *str, int strSize) {

0 commit comments

Comments
 (0)