#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"
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()
DPL::NamedInputPipe m_input;
DPL::NamedOutputPipe m_output;
- const std::string m_inputName;
- const std::string m_outputName;
+ std::string m_inputName;
+ std::string m_outputName;
};
} // Popup
} // Wrt