提交 89e98201 编写于 作者: L lnlan

fixed, to set errno in mq_receive and shm_get

Change-Id: Iecd1a896f92522ecc75d099c23761969a83b1d29
上级 8592e04c
......@@ -739,11 +739,8 @@ int mq_timedsend(mqd_t personal, const char *msg, size_t msgLen, unsigned int ms
(VOID)pthread_mutex_lock(&g_mqueueMutex);
privateMqPersonal = MqGetPrivDataBuff(personal);
if (privateMqPersonal == NULL) {
goto ERROUT_UNLOCK;
}
OS_MQ_GOTO_ERROUT_UNLOCK_IF(privateMqPersonal->mq_status != MQ_USE_MAGIC, EBADF);
OS_MQ_GOTO_ERROUT_UNLOCK_IF(privateMqPersonal == NULL || privateMqPersonal->mq_status != MQ_USE_MAGIC, EBADF);
mqueueCB = privateMqPersonal->mq_posixdes;
OS_MQ_GOTO_ERROUT_UNLOCK_IF(msgLen > (size_t)(mqueueCB->mqcb->queueSize - sizeof(UINT32)), EMSGSIZE);
......@@ -786,10 +783,7 @@ ssize_t mq_timedreceive(mqd_t personal, char *msg, size_t msgLen, unsigned int *
(VOID)pthread_mutex_lock(&g_mqueueMutex);
privateMqPersonal = MqGetPrivDataBuff(personal);
if (privateMqPersonal == NULL) {
goto ERROUT_UNLOCK;
}
if (privateMqPersonal->mq_status != MQ_USE_MAGIC) {
if (privateMqPersonal == NULL || privateMqPersonal->mq_status != MQ_USE_MAGIC) {
errno = EBADF;
goto ERROUT_UNLOCK;
}
......
......@@ -435,11 +435,6 @@ INT32 ShmGet(key_t key, size_t size, INT32 shmflg)
INT32 shmid;
SYSV_SHM_LOCK();
if (!((UINT32)shmflg & IPC_CREAT) &&
((UINT32)shmflg & IPC_EXCL)) {
ret = -EINVAL;
goto ERROR;
}
if (key == IPC_PRIVATE) {
ret = ShmAllocSeg(key, size, shmflg);
......@@ -454,6 +449,11 @@ INT32 ShmGet(key_t key, size_t size, INT32 shmflg)
}
} else {
shmid = ret;
if (((UINT32)shmflg & IPC_CREAT) &&
((UINT32)shmflg & IPC_EXCL)) {
ret = -EEXIST;
goto ERROR;
}
ret = ShmPermCheck(ShmFindSeg(shmid), (UINT32)shmflg & ACCESSPERMS);
if (ret != 0) {
ret = -ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册