diff --git a/graphics/nxmu/nx_connect.c b/graphics/nxmu/nx_connect.c index 401d20d925..0309e3d6c8 100644 --- a/graphics/nxmu/nx_connect.c +++ b/graphics/nxmu/nx_connect.c @@ -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; diff --git a/graphics/nxmu/nxmu_server.c b/graphics/nxmu/nxmu_server.c index 270285be29..352e561925 100644 --- a/graphics/nxmu/nxmu_server.c +++ b/graphics/nxmu/nxmu_server.c @@ -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);