C++11 tidying.
[dcpomatic.git] / src / tools / dcpomatic_disk_writer.cc
index 627aacc86dea73ebb645649b1e9f7e0340abcb34..dca09f729ad0ee37bbd4e12906ceac98d4fe146a 100644 (file)
@@ -31,7 +31,7 @@
 #include "lib/nanomsg.h"
 #include "lib/util.h"
 #include "lib/version.h"
-#include "lib/warnings.h"
+#include <dcp/warnings.h>
 
 #ifdef DCPOMATIC_POSIX
 #include <sys/ioctl.h>
@@ -177,13 +177,19 @@ try
                        "com.dcpomatic.write-drive",
                        [xml]() {
                                bool const success = Drive(xml).unmount();
-                               if (!nanomsg->send(success ? (DISK_WRITER_OK "\n") : (DISK_WRITER_ERROR "\n"), LONG_TIMEOUT)) {
+                               bool sent_reply = false;
+                               if (success) {
+                                       sent_reply = nanomsg->send(DISK_WRITER_OK "\n", LONG_TIMEOUT);
+                               } else {
+                                       sent_reply = nanomsg->send(DISK_WRITER_ERROR "\nCould not unmount drive\n1\n", LONG_TIMEOUT);
+                               }
+                               if (!sent_reply) {
                                        LOG_DISK_NC("CommunicationFailedError in unmount_finished");
                                        throw CommunicationFailedError ();
                                }
                        },
                        []() {
-                               if (!nanomsg->send(DISK_WRITER_ERROR "\n", LONG_TIMEOUT)) {
+                               if (!nanomsg->send(DISK_WRITER_ERROR "\nCould not get permission to unmount drive\n1\n", LONG_TIMEOUT)) {
                                        LOG_DISK_NC("CommunicationFailedError in unmount_finished");
                                        throw CommunicationFailedError ();
                                }
@@ -266,7 +272,7 @@ try
                        },
                        []() {
                                if (nanomsg) {
-                                       nanomsg->send(DISK_WRITER_ERROR "\nCould not obtain authorization to write to the drive\n", LONG_TIMEOUT);
+                                       nanomsg->send(DISK_WRITER_ERROR "\nCould not obtain authorization to write to the drive\n1\n", LONG_TIMEOUT);
                                }
                        });
        }