[Libreoffice-commits] online.git: Branch 'private/hcvcastro/bind-mount' - loolwsd/LOOLWSD.cpp

Henry Castro hcastro at collabora.com
Wed Dec 9 12:40:31 PST 2015


 loolwsd/LOOLWSD.cpp |   27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

New commits:
commit e3b521eec9504002e205adbc9a81e188d9360523
Author: Henry Castro <hcastro at collabora.com>
Date:   Wed Dec 9 16:38:03 2015 -0400

    loolwsd: avoid warning if file exists

diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 5781cb2..6eb5018 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -863,22 +863,29 @@ void LOOLWSD::componentMain()
 #ifdef __linux
         // Create the urandom and random devices
         File(Path(jailPath, "/dev")).createDirectory();
-        if (mknod((jailPath.toString() + "/dev/random").c_str(),
+        if (!File(jailPath.toString() + "/dev/random").exists())
+        {
+            if (mknod((jailPath.toString() + "/dev/random").c_str(),
                     S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH,
                     makedev(1, 8)) != 0)
-        {
-            Application::instance().logger().error(Util::logPrefix() +
-                    "mknod(" + jailPath.toString() + "/dev/random) failed: " +
-                    strerror(errno));
+            {
+                Application::instance().logger().error(Util::logPrefix() +
+                        "mknod(" + jailPath.toString() + "/dev/random) failed: " +
+                        strerror(errno));
 
+            }
         }
-        if (mknod((jailPath.toString() + "/dev/urandom").c_str(),
+
+        if (!File(jailPath.toString() + "/dev/urandom").exists())
+        {
+            if (mknod((jailPath.toString() + "/dev/urandom").c_str(),
                     S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH,
                     makedev(1, 9)) != 0)
-        {
-            Application::instance().logger().error(Util::logPrefix() +
-                    "mknod(" + jailPath.toString() + "/dev/urandom) failed: " +
-                    strerror(errno));
+            {
+                Application::instance().logger().error(Util::logPrefix() +
+                        "mknod(" + jailPath.toString() + "/dev/urandom) failed: " +
+                        strerror(errno));
+            }
         }
 #endif
 


More information about the Libreoffice-commits mailing list