!633 fix: codex清理

Merge pull request !633 from Far/master
This commit is contained in:
openharmony_ci 2021-09-27 08:38:37 +00:00 committed by Gitee
commit 7d7cff4c51
2 changed files with 12 additions and 0 deletions

View File

@ -404,6 +404,8 @@ int VnodeLookupAt(const char *path, struct Vnode **result, uint32_t flags, struc
*result = currentVnode;
if (currentVnode->filePath == NULL) {
currentVnode->filePath = normalizedPath;
} else {
free(normalizedPath);
}
return ret;
} else if (VfsVnodePermissionCheck(currentVnode, EXEC_OP)) {

View File

@ -76,6 +76,10 @@ static int OsELFClose(int procFd)
int ret;
/* Process procfd convert to system global procfd */
int sysfd = DisassociateProcessFd(procFd);
if (sysfd < 0) {
return -EBADF;
}
ret = close(sysfd);
if (ret < 0) {
AssociateSystemFd(procFd, sysfd);
@ -120,6 +124,10 @@ STATIC INT32 OsReadELFInfo(INT32 procfd, UINT8 *buffer, size_t readSize, off_t o
ssize_t byteNum;
off_t returnPos;
INT32 fd = GetAssociatedSystemFd(procfd);
if (fd < 0) {
PRINT_ERR("%s[%d], Invalid procfd!\n", __FUNCTION__, __LINE__);
return LOS_NOK;
}
if (readSize > 0) {
returnPos = lseek(fd, offset, SEEK_SET);
@ -218,6 +226,8 @@ STATIC INT32 OsReadEhdr(const CHAR *fileName, ELFInfo *elfInfo, BOOL isExecFile)
ret = fs_getfilep(GetAssociatedSystemFd(elfInfo->procfd), &OsCurrProcessGet()->execFile);
if (ret) {
PRINT_ERR("%s[%d], Failed to get struct file %s!\n", __FUNCTION__, __LINE__, fileName);
/* File will be closed by OsLoadELFFile */
return ret;
}
}
#endif