Store bsd_name in the OSXDisk struct.
authorCarl Hetherington <cth@carlh.net>
Fri, 3 Jan 2025 00:23:32 +0000 (01:23 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 6 Jan 2025 23:41:32 +0000 (00:41 +0100)
src/lib/cross.h
src/lib/cross_osx.cc

index 78a73b13eaf4cd6f01d08d9f64ff1a8504c78e10..10b0b113f22940ff1081d67759f21bb31d547233 100644 (file)
@@ -141,6 +141,7 @@ void disk_write_finished ();
 
 struct OSXDisk
 {
+       std::string bsd_name;
        std::string device;
        boost::optional<std::string> vendor;
        boost::optional<std::string> model;
index a201cc5f93767c62f7edf9dc5842fd6936853389..ae5ec85c4d4c8e88ef475878c16bcde90cb81984 100644 (file)
@@ -281,8 +281,9 @@ disk_appeared (DADiskRef disk, void* context)
        LOG_DISK("%1 appeared", bsd_name);
 
        OSXDisk this_disk;
+       this_disk.bsd_name = bsd_name;
 
-       this_disk.device = string("/dev/") + bsd_name;
+       this_disk.device = string("/dev/") + this_disk.bsd_name;
        LOG_DISK("Device is %1", this_disk.device);
 
        CFDictionaryRef description = DADiskCopyDescription (disk);
@@ -304,11 +305,11 @@ disk_appeared (DADiskRef disk, void* context)
 
        this_disk.system = get_bool(description, kDADiskDescriptionDeviceInternalKey) && !get_bool(description, kDADiskDescriptionMediaRemovableKey);
        this_disk.writeable = get_bool(description, kDADiskDescriptionMediaWritableKey);
-       this_disk.partition = string(bsd_name).find("s", 5) != std::string::npos;
+       this_disk.partition = string(this_disk.bsd_name).find("s", 5) != std::string::npos;
 
        LOG_DISK(
                "%1 %2 %3 %4 mounted at %5",
-               bsd_name,
+               this_disk.bsd_name,
                this_disk.system ? "system" : "non-system",
                this_disk.writeable ? "writeable" : "read-only",
                this_disk.partition ? "partition" : "drive",