From 0674d6eaf144d2765d77c6a1805b99b8d5eebfd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= Date: Mon, 26 Feb 2024 18:59:23 +0100 Subject: [PATCH] Don't resize DiskCache without a file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DiskCache computes its size from a file. Skip ResizeCache Without file (i.e. 'empty' CD) Fixes #1426 Signed-off-by: Klaus Kämpf --- cpp/devices/scsicd.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cpp/devices/scsicd.cpp b/cpp/devices/scsicd.cpp index e1d356bd..a9f9717d 100644 --- a/cpp/devices/scsicd.cpp +++ b/cpp/devices/scsicd.cpp @@ -179,7 +179,11 @@ void SCSICD::ModeSelect(scsi_command cmd, cdb_t cdb, span buf, in ClearTrack(); CreateDataTrack(); FlushCache(); - ResizeCache(GetFilename(), GetRawMode()); + string filename; + if ((filename = GetFilename()) != "") { + // DiskCache fails without a file to compute the cache size + ResizeCache(filename, GetRawMode()); + } } if (const string result = scsi_command_util::ModeSelect(cmd, cdb, buf, length, sector_size);