Properly close file to be printed (#1428)

This commit is contained in:
Uwe Seimet 2024-02-02 19:55:07 +01:00 committed by Daniel Markstedt
parent 274b93fe27
commit 4ae03e2ec7

View File

@ -79,7 +79,9 @@ void SCSIPrinter::CleanUp()
if (out.is_open()) { if (out.is_open()) {
out.close(); out.close();
}
if (!filename.empty()) {
error_code error; error_code error;
remove(path(filename), error); remove(path(filename), error);
@ -136,6 +138,8 @@ void SCSIPrinter::SynchronizeBuffer()
throw scsi_exception(sense_key::aborted_command); throw scsi_exception(sense_key::aborted_command);
} }
out.close();
string cmd = GetParam("cmd"); string cmd = GetParam("cmd");
const size_t file_position = cmd.find("%f"); const size_t file_position = cmd.find("%f");
assert(file_position != string::npos); assert(file_position != string::npos);