Fix restore on Linux with latest UDisks/libblockdev (#647)

The newly created partition cannot start on offset 0, previously
UDisks was able to compensate for this, but there is a bug in the
latest UDisks/libblockdev and this no longer works. But in general
offset 0 for a new partition doesn't make sense. We can also use
0 for size to let UDisks calculate the maximal size instead of
passing the underlying device size.

Fixes: #644
This commit is contained in:
Vojtech Trefny 2023-09-15 14:13:42 +02:00 committed by Maria Alexeeva
parent a1699b6748
commit 2b5ce77d20

View File

@ -77,7 +77,7 @@ void RestoreJob::work() {
}
QDBusInterface partitionTable("org.freedesktop.UDisks2", where, "org.freedesktop.UDisks2.PartitionTable", QDBusConnection::systemBus(), this);
QDBusReply<QDBusObjectPath> partitionReply = partitionTable.call("CreatePartition", 0ULL, device.property("Size").toULongLong(), "", "", Properties());
QDBusReply<QDBusObjectPath> partitionReply = partitionTable.call("CreatePartition", 1ULL, 0ULL, "", "", Properties());
if (!partitionReply.isValid()) {
err << partitionReply.error().message();
err.flush();