From fe86227a3f9afb2fc759e7f8264fc69515556a32 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Tue, 25 Nov 2025 20:43:32 -0500 Subject: [PATCH] BPartition: Return B_BUSY when calling Mount() ... on an already mounted volume. Change-Id: I7bffa385c6d1850db9106c3ab9a5a66e79165d11 Reviewed-on: https://review.haiku-os.org/c/haiku/+/10024 Tested-by: Commit checker robot Reviewed-by: waddlesplash --- src/kits/storage/disk_device/Partition.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/kits/storage/disk_device/Partition.cpp b/src/kits/storage/disk_device/Partition.cpp index b237f96..747880c 100644 --- a/src/kits/storage/disk_device/Partition.cpp +++ b/src/kits/storage/disk_device/Partition.cpp @@ -555,13 +555,18 @@ \param mountFlags Currently only \c B_MOUNT_READ_ONLY is defined, which forces the volume to be mounted read-only. \param parameters File system specific mount parameters. - \return \c B_OK, if everything went fine, another error code otherwise. + \return \c B_OK if everything went fine, another error code otherwise. + \return \c B_BUSY if already mounted. + \return \c B_BAD_VALUE if volume does not contain a file system. + \return \c B_NOT_ALLOWED if a permission error occurs. */ status_t -BPartition::Mount(const char* mountPoint, uint32 mountFlags, - const char* parameters) +BPartition::Mount(const char* mountPoint, uint32 mountFlags, const char* parameters) { - if (IsMounted() || !ContainsFileSystem()) + if (IsMounted()) + return B_BUSY; + + if (!ContainsFileSystem()) return B_BAD_VALUE; // get the partition path -- gitore 0.2.3