Skip to content
Snippets Groups Projects
Commit f48db4ef authored by patacongo's avatar patacongo
Browse files

Fixes to MQ open logic

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1348 42af7a65-404d-4744-a932-0658087f49c3
parent 83f73e5b
No related branches found
No related tags found
No related merge requests found
......@@ -152,7 +152,7 @@ NXHANDLE nx_connectionstance(FAR const char *svrmqname)
#else
conn->crdmq = mq_open(climqname, O_RDONLY|O_CREAT|O_NONBLOCK, 0666, &attr);
#endif
if (conn->crdmq)
if (conn->crdmq == (mqd_t)-1)
{
gdbg("mq_open(%s) failed: %d\n", climqname, errno);
goto errout_with_conn;
......@@ -165,7 +165,7 @@ NXHANDLE nx_connectionstance(FAR const char *svrmqname)
attr.mq_flags = 0;
conn->cwrmq = mq_open(svrmqname, O_WRONLY|O_CREAT, 0666, &attr);
if (conn->cwrmq)
if (conn->cwrmq == (mqd_t)-1)
{
gdbg("mq_open(%s) failed: %d\n", svrmqname, errno);
goto errout_with_rmq;
......
......@@ -116,7 +116,7 @@ static inline void nxmu_connect(FAR struct nxfe_conn_s *conn)
outmsg.msgid = NX_CLIMSG_CONNECTED;
conn->swrmq = mq_open(mqname, O_WRONLY);
if (conn->swrmq)
if (conn->swrmq == (mqd_t)-1)
{
gdbg("mq_open(%s) failed: %d\n", mqname, errno);
outmsg.msgid = NX_CLIMSG_DISCONNECTED;
......@@ -224,7 +224,7 @@ static inline int nxmu_setup(FAR const char *mqname,
attr.mq_flags = 0;
fe->conn.crdmq = mq_open(mqname, O_RDONLY|O_CREAT, 0666, &attr);
if (fe->conn.crdmq)
if (fe->conn.crdmq == (mqd_t)-1)
{
gdbg("mq_open(%s) failed: %d\n", mqname, errno);
return ERROR; /* mq_open sets errno */
......@@ -239,10 +239,8 @@ static inline int nxmu_setup(FAR const char *mqname,
* the server message loop.
*/
/* Open the server MQ for writing (same attributes) */
fe->conn.cwrmq = mq_open(mqname, O_WRONLY);
if (fe->conn.cwrmq)
fe->conn.swrmq = mq_open(mqname, O_WRONLY);
if (fe->conn.swrmq == (mqd_t)-1)
{
gdbg("mq_open(%s) failed: %d\n", mqname, errno);
mq_close(fe->conn.crdmq);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment