}
int hw_umount_filesystems(struct hw_destination* dest, const char* prefix) {
+ // Write all buffers to disk before umounting
+ hw_sync();
+
// boot
if (*dest->part_boot) {
hw_umount(dest->part_boot);
mysystem(logfile, commandstring);
}
+ // Umount the destination drive
+ hw_umount_filesystems(destination, DESTINATION_MOUNT_PATH);
+
+ // Stop the RAID array if we are using RAID
+ if (destination->is_raid)
+ hw_stop_all_raid_arrays(logfile);
+
// Umount source drive and eject
hw_umount(SOURCE_MOUNT_PATH);
free(helpline);
free(sourcedrive);
-
- if (destination) {
- hw_sync();
-
- hw_umount_filesystems(destination, DESTINATION_MOUNT_PATH);
- free(destination);
- }
+ free(destination);
hw_stop_all_raid_arrays(logfile);