Allow export with one audio stream per channel.
[dcpomatic.git] / src / lib / cross_linux.cc
index 7b807a44120ac10d62fc249896ac6fd894eb69bd..e17f188b9f8aacece46cfa29eb7cd884ab3d9797 100644 (file)
@@ -33,7 +33,7 @@ extern "C" {
 #include <boost/algorithm/string.hpp>
 #include <boost/foreach.hpp>
 #include <boost/function.hpp>
-#ifdef DCPOMATIC_DISK
+#if BOOST_VERSION >= 106100
 #include <boost/dll/runtime_symbol_info.hpp>
 #endif
 #include <unistd.h>
@@ -113,7 +113,10 @@ run_ffprobe (boost::filesystem::path content, boost::filesystem::path out)
 {
        string ffprobe = "ffprobe \"" + content.string() + "\" 2> \"" + out.string() + "\"";
        LOG_GENERAL (N_("Probing with %1"), ffprobe);
-        system (ffprobe.c_str ());
+       int const r = system (ffprobe.c_str());
+       if (r == -1 || (WIFEXITED(r) && WEXITSTATUS(r) != 0)) {
+               LOG_GENERAL (N_("Could not run ffprobe (system returned %1"), r);
+       }
 }
 
 list<pair<string, string> >
@@ -157,7 +160,12 @@ directory_containing_executable ()
 boost::filesystem::path
 openssl_path ()
 {
-       return directory_containing_executable() / "dcpomatic2_openssl";
+       boost::filesystem::path p = directory_containing_executable() / "dcpomatic2_openssl";
+       if (boost::filesystem::is_regular_file(p)) {
+               return p;
+       }
+
+       return "dcpomatic2_openssl";
 }
 
 
@@ -371,9 +379,10 @@ unprivileged ()
        uid_t ruid, euid, suid;
        if (getresuid(&ruid, &euid, &suid) == -1) {
                cerr << "getresuid() failed.\n";
-               exit (EXIT_FAILURE);
        }
-       seteuid (ruid);
+       if (seteuid(ruid) == -1) {
+               cerr << "seteuid() failed.\n";
+       }
 }
 
 PrivilegeEscalator::~PrivilegeEscalator ()
@@ -383,7 +392,10 @@ PrivilegeEscalator::~PrivilegeEscalator ()
 
 PrivilegeEscalator::PrivilegeEscalator ()
 {
-       seteuid (0);
+       int const r = seteuid(0);
+       if (r < 0) {
+               throw PrivilegeError (String::compose("seteuid() call failed with %1", errno));
+       }
 }
 
 boost::filesystem::path