projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1bcf14c
)
Sleep for a while if necessary to allow disks to wake up (#1916).
author
Carl Hetherington
<cth@carlh.net>
Mon, 19 Apr 2021 20:22:50 +0000
(22:22 +0200)
committer
Carl Hetherington
<cth@carlh.net>
Mon, 19 Apr 2021 20:22:50 +0000
(22:22 +0200)
src/lib/ext.cc
patch
|
blob
|
history
diff --git
a/src/lib/ext.cc
b/src/lib/ext.cc
index b88a88726b99c6f79fc5b91398b2a54487ec8281..39c90ae124e0f547f0e4e48ae29436c8d20e7f65 100644
(file)
--- a/
src/lib/ext.cc
+++ b/
src/lib/ext.cc
@@
-331,6
+331,18
@@
try
file_windows_partition_set (bdevs.partitions[0].part_offset, bdevs.partitions[0].part_size);
#else
file_dev_name_set (posix_partition.c_str());
file_windows_partition_set (bdevs.partitions[0].part_offset, bdevs.partitions[0].part_size);
#else
file_dev_name_set (posix_partition.c_str());
+
+ /* On macOS (at least) if you try to write to a drive that is sleeping the ext4_mkfs call
+ * below is liable to return EIO because it can't open the device. Try to work around that
+ * here by opening and closing the device, waiting 5 seconds if it fails.
+ */
+ int wake = open(posix_partition.c_str(), O_RDWR);
+ if (wake == -1) {
+ dcpomatic_sleep_seconds (5);
+ } else {
+ close(wake);
+ }
+
bd = file_dev_get ();
#endif
bd = file_dev_get ();
#endif