!207 错误码不符合预期问题修复

Merge pull request !207 from lnlan/ker_fixed
This commit is contained in:
openharmony_ci 2021-05-05 10:16:01 +08:00 committed by Gitee
commit db16ef1430
2 changed files with 7 additions and 13 deletions

View File

@ -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;
}

View File

@ -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;