From fdc13d7d973cfd64241cd072e0c09bea5034e116 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 2 Feb 2020 22:12:49 +0100 Subject: [PATCH] Installer: do not allow installing to read-only partitions. This would probably not work, right? Fixes #14614. --- src/apps/installer/WorkerThread.cpp | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/apps/installer/WorkerThread.cpp b/src/apps/installer/WorkerThread.cpp index 98c5e81191..f289f5bb4e 100644 --- a/src/apps/installer/WorkerThread.cpp +++ b/src/apps/installer/WorkerThread.cpp @@ -250,11 +250,9 @@ WorkerThread::ScanDisksPartitions(BMenu *srcMenu, BMenu *targetMenu) BDiskDevice device; BPartition *partition = NULL; - printf("\nScanDisksPartitions source partitions begin\n"); SourceVisitor srcVisitor(srcMenu); fDDRoster.VisitEachMountedPartition(&srcVisitor, &device, &partition); - printf("\nScanDisksPartitions target partitions begin\n"); TargetVisitor targetVisitor(targetMenu); fDDRoster.VisitEachPartition(&targetVisitor, &device, &partition); } @@ -775,9 +773,6 @@ bool SourceVisitor::Visit(BPartition *partition, int32 level) { BPath path; - printf("SourceVisitor::Visit(BPartition *) : %s '%s'\n", - (partition->GetPath(&path) == B_OK) ? path.Path() : "", - partition->ContentName()); if (partition->ContentType() == NULL) return false; @@ -834,23 +829,15 @@ TargetVisitor::Visit(BDiskDevice *device) bool TargetVisitor::Visit(BPartition *partition, int32 level) { - BPath path; - if (partition->GetPath(&path) == B_OK) - printf("TargetVisitor::Visit(BPartition *) : %s\n", path.Path()); - printf("TargetVisitor::Visit(BPartition *) : %s\n", - partition->ContentName()); - if (partition->ContentSize() < 20 * 1024 * 1024) { // reject partitions which are too small anyway // TODO: Could depend on the source size - printf(" too small\n"); return false; } if (partition->CountChildren() > 0) { // Looks like an extended partition, or the device itself. // Do not accept this as target... - printf(" no leaf partition\n"); return false; } @@ -864,9 +851,11 @@ TargetVisitor::Visit(BPartition *partition, int32 level) isBootPartition = strcmp(BOOT_PATH, mountPoint.Path()) == 0; } - // Only non-boot BFS partitions are valid targets, but we want to display the - // other partitions as well, in order not to irritate the user. + // Only writable non-boot BFS partitions are valid targets, but we want to + // display the other partitions as well, to inform the user that they are + // detected but somehow not appropriate. bool isValidTarget = isBootPartition == false + && !partition->IsReadOnly() && partition->ContentType() != NULL && strcmp(partition->ContentType(), kPartitionTypeBFS) == 0;