Fix SCSI device cache type check

Vitaliy Filippov 2022-12-17 17:06:14 +03:00
parent 49b88b01f9
commit f7fa9d5e34
1 changed files with 2 additions and 2 deletions

View File

@ -145,10 +145,10 @@ int disable_cache(std::string dev)
closedir(dir);
// Check cache_type
scsi_disk += "/cache_type";
std::string cache_type = read_file(scsi_disk);
std::string cache_type = trim(read_file(scsi_disk));
if (cache_type == "")
return 1;
if (cache_type == "write back")
if (cache_type != "write through")
{
int fd = open(scsi_disk.c_str(), O_WRONLY);
if (fd < 0 || write_blocking(fd, (void*)"write through", strlen("write through")) != strlen("write through"))