Fix seek error when filling device with random data or zeroes.

This commit is contained in:
Andrius Štikonas 2021-11-12 01:02:15 +00:00
parent a9998425fd
commit e9fc875c5e
1 changed files with 2 additions and 1 deletions

View File

@ -80,7 +80,8 @@ bool ExternalCommandHelper::readData(const QString& sourceDevice, QByteArray& bu
return false;
}
if (!device.seek(offset)) {
// Sequential devices such as /dev/zero or /dev/urandom return false on seek().
if (!device.isSequential() && !device.seek(offset)) {
qCritical() << xi18n("Could not seek position %1 on device <filename>%2</filename>.", offset, sourceDevice);
return false;
}