diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-11-29 16:04:20 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-11-29 16:04:20 +0000 |
commit | 80b884cddc90f31a5ea641947d0d8d6a8b9e22f6 (patch) | |
tree | 01d80c4d57fb08aac3b6198e01f5e937f341e0ef | |
parent | bf4e1a095e6c3acef16ed7056921b7c65e8a16c6 (diff) | |
download | px4-nuttx-80b884cddc90f31a5ea641947d0d8d6a8b9e22f6.tar.gz px4-nuttx-80b884cddc90f31a5ea641947d0d8d6a8b9e22f6.tar.bz2 px4-nuttx-80b884cddc90f31a5ea641947d0d8d6a8b9e22f6.zip |
Fixes to MQ open logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1348 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r-- | nuttx/graphics/nxmu/nx_connect.c | 4 | ||||
-rw-r--r-- | nuttx/graphics/nxmu/nxmu_server.c | 10 |
2 files changed, 6 insertions, 8 deletions
diff --git a/nuttx/graphics/nxmu/nx_connect.c b/nuttx/graphics/nxmu/nx_connect.c index 401d20d92..0309e3d6c 100644 --- a/nuttx/graphics/nxmu/nx_connect.c +++ b/nuttx/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/nuttx/graphics/nxmu/nxmu_server.c b/nuttx/graphics/nxmu/nxmu_server.c index 270285be2..352e56192 100644 --- a/nuttx/graphics/nxmu/nxmu_server.c +++ b/nuttx/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); |