[Release] wrt-plugins-common_0.3.76
[platform/framework/web/wrt-plugins-common.git] / src / wrt-popup / wrt / popup-runner / PopupInvoker.cpp
index 10997dc..28f32a1 100644 (file)
@@ -22,6 +22,7 @@
 #include <dpl/waitable_handle.h>
 #include <dpl/binary_queue.h>
 #include <dpl/serialization.h>
+#include <dpl/exception.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include "PopupEnum.h"
@@ -33,20 +34,20 @@ const char *POPUP_EXEC = "/usr/bin/wrt-popup-wrt-runtime";
 
 namespace Wrt {
 namespace Popup {
-PopupInvoker::PopupInvoker() :
-    m_inputName(tmpnam_r(NULL)),
-    m_outputName(tmpnam_r(NULL))
+PopupInvoker::PopupInvoker()
 {
-    Try
-    {
-        m_input.Create(m_inputName);
-        m_output.Create(m_outputName);
-        LogDebug("Pipes created");
-    }
-    Catch(DPL::Exception)
-    {
-        LogError("Cannot create pipes");
-    }
+    char tmp[L_tmpnam + 1];
+    if (NULL == tmpnam(tmp))
+        ThrowMsg(DPL::Exception, "Failed to get pipe name");
+    m_inputName = tmp;
+
+    if (NULL == tmpnam(tmp))
+        ThrowMsg(DPL::Exception, "Failed to get pipe name");
+    m_outputName = tmp;
+
+    m_input.Create(m_inputName);
+    m_output.Create(m_outputName);
+    LogDebug("Pipes created");
 }
 
 PopupInvoker::~PopupInvoker()