diff -r a55f2523b53c -r f6bbc0348c44 src/sim/process.cc --- a/src/sim/process.cc Fri Aug 28 14:31:03 2015 -0500 +++ b/src/sim/process.cc Sat Aug 29 10:53:21 2015 -0500 @@ -335,6 +335,18 @@ // Search through the input options and set fd if match is found; // otherwise, open an input file and seek to location. FDEntry *fde_stdin = getFDEntry(STDIN_FILENO); + + // Check if user has specified a different input file, and if so, use it + // instead of the file specified in the checkpoint. This also resets the + // file offset from the checkpointed value + string new_in = ((ProcessParams*)params())->input; + if (new_in != fde_stdin->filename) { + warn("Using new input file (%s) rather than checkpointed (%s)\n", + new_in, fde_stdin->filename); + fde_stdin->filename = new_in; + fde_stdin->fileOffset = 0; + } + if ((it = imap.find(fde_stdin->filename)) != imap.end()) { fde_stdin->fd = it->second; } else { @@ -345,6 +357,18 @@ // Search through the output/error options and set fd if match is found; // otherwise, open an output file and seek to location. FDEntry *fde_stdout = getFDEntry(STDOUT_FILENO); + + // Check if user has specified a different output file, and if so, use it + // instead of the file specified in the checkpoint. This also resets the + // file offset from the checkpointed value + string new_out = ((ProcessParams*)params())->output; + if (new_out != fde_stdout->filename) { + warn("Using new output file (%s) rather than checkpointed (%s)\n", + new_out, fde_stdout->filename); + fde_stdout->filename = new_out; + fde_stdout->fileOffset = 0; + } + if ((it = oemap.find(fde_stdout->filename)) != oemap.end()) { fde_stdout->fd = it->second; } else { @@ -353,6 +377,18 @@ } FDEntry *fde_stderr = getFDEntry(STDERR_FILENO); + + // Check if user has specified a different error file, and if so, use it + // instead of the file specified in the checkpoint. This also resets the + // file offset from the checkpointed value + string new_err = ((ProcessParams*)params())->errout; + if (new_err != fde_stderr->filename) { + warn("Using new error file (%s) rather than checkpointed (%s)\n", + new_err, fde_stderr->filename); + fde_stderr->filename = new_err; + fde_stderr->fileOffset = 0; + } + if (fde_stdout->filename == fde_stderr->filename) { // Reuse the same file descriptor if these match. fde_stderr->fd = fde_stdout->fd;