diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-11-09 08:42:49 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-11-09 08:42:49 +0000 |
commit | df63209c04d7671864dffb65eaf37c8e77e7ce7f (patch) | |
tree | 213e138f7f15a4f3bb64ace83acfb343713fd742 /fbench | |
parent | 9cc12f086f2d1811558d9b2958b90a65e8d8d626 (diff) |
Ensure that you report the correct filename when producing error message.
Diffstat (limited to 'fbench')
-rw-r--r-- | fbench/src/fbench/client.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/fbench/src/fbench/client.cpp b/fbench/src/fbench/client.cpp index 912589a1fed..f539e990ad9 100644 --- a/fbench/src/fbench/client.cpp +++ b/fbench/src/fbench/client.cpp @@ -37,7 +37,8 @@ void Client::runMe(Client * me) { void Client::run() { - char filename[1024]; + char inputFilename[1024]; + char outputFilename[1024]; char timestr[64]; int linelen; /// int reslen; @@ -45,19 +46,19 @@ Client::run() std::this_thread::sleep_for(std::chrono::milliseconds(_args->_delay)); // open query file - snprintf(filename, 1024, _args->_filenamePattern, _args->_myNum); - if (!_reader->Open(filename)) { + snprintf(inputFilename, 1024, _args->_filenamePattern, _args->_myNum); + if (!_reader->Open(inputFilename)) { printf("Client %d: ERROR: could not open file '%s' [read mode]\n", - _args->_myNum, filename); + _args->_myNum, inputFilename); _status->SetError("Could not open query file."); return; } if (_args->_outputPattern != NULL) { - snprintf(filename, 1024, _args->_outputPattern, _args->_myNum); - _output = std::make_unique<std::ofstream>(filename, std::ofstream::out | std::ofstream::binary); + snprintf(outputFilename, 1024, _args->_outputPattern, _args->_myNum); + _output = std::make_unique<std::ofstream>(outputFilename, std::ofstream::out | std::ofstream::binary); if (_output->fail()) { printf("Client %d: ERROR: could not open file '%s' [write mode]\n", - _args->_myNum, filename); + _args->_myNum, outputFilename); _status->SetError("Could not open output file."); return; } @@ -94,7 +95,7 @@ Client::run() linelen = _reader->ReadLine(_linebuf, _linebufsize); if (linelen < 0) { fprintf(stderr, "Client %d: ERROR: could not read any lines from '%s'\n", - _args->_myNum, filename); + _args->_myNum, inputFilename); _status->SetError("Could not read any lines from query file."); break; } |