Skip to content

Commit

Permalink
Reading a file from the command-line should not use include paths
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-ess committed Nov 5, 2024
1 parent be2c890 commit fcf3d2a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions modules/database/src/ioc/dbtemplate/msi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ struct inputData {
inputData() { memset(inputBuffer, 0, sizeof(inputBuffer) * sizeof(inputBuffer[0])); };
};

static void inputOpenFile(inputData *pinputData, const char * const filename);
static void inputOpenFile(inputData *pinputData, const char * const filename, int fromInclude);
static void inputCloseFile(inputData *pinputData);
static void inputCloseAllFiles(inputData *pinputData);

Expand Down Expand Up @@ -439,7 +439,7 @@ static void inputBegin(inputData * const pinputData, const char * const fileName
{
ENTER;
inputCloseAllFiles(pinputData);
inputOpenFile(pinputData, fileName);
inputOpenFile(pinputData, fileName, FALSE);
EXIT;
}

Expand All @@ -466,7 +466,7 @@ static void inputNewIncludeFile(inputData * const pinputData,
const char * const name)
{
ENTER;
inputOpenFile(pinputData,name);
inputOpenFile(pinputData, name, TRUE);
EXIT;
}

Expand Down Expand Up @@ -505,7 +505,7 @@ static int isPathRelative(const char * const path) {
#endif
}

static void inputOpenFile(inputData *pinputData, const char * const filename)
static void inputOpenFile(inputData *pinputData, const char * const filename, int fromInclude)
{
std::list<std::string>& pathList = pinputData->pathList;
std::list<std::string>::iterator pathIt = pathList.end();
Expand All @@ -517,7 +517,7 @@ static void inputOpenFile(inputData *pinputData, const char * const filename)
STEP("Using stdin");
fp = stdin;
}
else if (pathList.empty() || !isPathRelative(filename)){
else if (!fromInclude || pathList.empty() || !isPathRelative(filename)){
STEPS("Opening ", filename);
fp = fopen(filename, "r");
}
Expand Down

0 comments on commit fcf3d2a

Please sign in to comment.