提交 1a3f3f54 编写于 作者: O openharmony_ci 提交者: Gitee

!302 fix: Codex告警清零

Merge pull request !302 from Far/master
......@@ -49,6 +49,7 @@
int main(int argc, char * const *argv)
{
int ret;
pid_t gid;
const char *shellPath = "/bin/mksh";
#ifdef LOSCFG_QUICK_START
......@@ -74,9 +75,14 @@ int main(int argc, char * const *argv)
if (ret < 0) {
printf("Failed to fork for shell\n");
} else if (ret == 0) {
ret = tcsetpgrp(STDIN_FILENO, getpgrp());
gid = getpgrp();
if (gid < 0) {
printf("get group id failed, pgrpid %d, errno %d\n", gid, errno);
exit(0);
}
ret = tcsetpgrp(STDIN_FILENO, gid);
if (ret != 0) {
printf("tcsetpgrp failed, pgrpid %d, errno %d\n", getpgrp(), errno);
printf("tcsetpgrp failed, errno %d\n", errno);
exit(0);
}
(void)execve(shellPath, NULL, NULL);
......
......@@ -333,6 +333,7 @@ static void DoCmdExec(const char *cmdName, const char *cmdline, unsigned int len
{
int ret;
pid_t forkPid;
pid_t gid;
if (strncmp(cmdline, SHELL_EXEC_COMMAND, SHELL_EXEC_COMMAND_BYTES) == 0) {
forkPid = fork();
......@@ -345,9 +346,14 @@ static void DoCmdExec(const char *cmdName, const char *cmdline, unsigned int len
exit(1);
}
ret = tcsetpgrp(STDIN_FILENO, getpgrp());
gid = getpgrp();
if (gid < 0) {
printf("get group id failed, pgrpid %d, errno %d\n", gid, errno);
}
ret = tcsetpgrp(STDIN_FILENO, gid);
if (ret != 0) {
printf("tcsetpgrp failed, pgrpid %d, errno %d\n", getpgrp(), errno);
printf("tcsetpgrp failed, errno %d\n", errno);
}
ret = execve((const char *)cmdParsed->paramArray[0], (char * const *)cmdParsed->paramArray, NULL);
......
......@@ -104,7 +104,7 @@ typedef struct {
extern VOID *OsTaskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack, BOOL initFlag);
extern VOID OsUserCloneParentStack(VOID *childStack, UINTPTR parentTopOfStask, UINT32 parentStackSize);
extern VOID OsUserTaskStackInit(TaskContext *context, UINTPTR taskEntry, UINTPTR stack);
extern VOID OsInitSignalContext(VOID *sp, VOID *signalContext, UINTPTR sigHandler, UINT32 signo, UINT32 param);
extern VOID OsInitSignalContext(const VOID *sp, VOID *signalContext, UINTPTR sigHandler, UINT32 signo, UINT32 param);
extern void arm_clean_cache_range(UINTPTR start, UINTPTR end);
extern void arm_inv_cache_range(UINTPTR start, UINTPTR end);
......
......@@ -126,7 +126,7 @@ LITE_OS_SEC_TEXT_INIT VOID OsUserTaskStackInit(TaskContext *context, UINTPTR tas
context->PC = (UINTPTR)taskEntry;
}
VOID OsInitSignalContext(VOID *sp, VOID *signalContext, UINTPTR sigHandler, UINT32 signo, UINT32 param)
VOID OsInitSignalContext(const VOID *sp, VOID *signalContext, UINTPTR sigHandler, UINT32 signo, UINT32 param)
{
IrqContext *newSp = (IrqContext *)signalContext;
(VOID)memcpy_s(signalContext, sizeof(IrqContext), sp, sizeof(IrqContext));
......
......@@ -865,7 +865,7 @@ INT32 los_disk_write(INT32 drvID, const VOID *buf, UINT64 sector, UINT32 count)
#endif
INT32 result = VFS_ERROR;
los_disk *disk = get_disk(drvID);
if (disk == NULL) {
if (disk == NULL || disk->dev == NULL || disk->dev->data == NULL) {
return result;
}
......@@ -896,7 +896,7 @@ INT32 los_disk_write(INT32 drvID, const VOID *buf, UINT64 sector, UINT32 count)
} else {
#endif
struct block_operations *bops = (struct block_operations *)((struct drv_data *)disk->dev->data)->ops;
if ((disk->dev != NULL) && (bops != NULL) && (bops->write != NULL)) {
if ((bops != NULL) && (bops->write != NULL)) {
result = bops->write(disk->dev, (UINT8 *)buf, sector, count);
if (result == (INT32)count) {
result = ENOERR;
......@@ -1151,6 +1151,9 @@ INT32 los_disk_cache_clear(INT32 drvID)
los_part *part = get_part(drvID);
los_disk *disk = NULL;
if (part == NULL) {
return VFS_ERROR;
}
result = OsSdSync(part->disk_id);
if (result != 0) {
PRINTK("[ERROR]disk_cache_clear SD sync failed!\n");
......@@ -1159,7 +1162,7 @@ INT32 los_disk_cache_clear(INT32 drvID)
disk = get_disk(part->disk_id);
if (disk == NULL) {
return -1;
return VFS_ERROR;
}
DISK_LOCK(&disk->disk_mutex);
......
......@@ -171,7 +171,7 @@ BOOL IsConsoleOccupied(const CONSOLE_CB *consoleCB)
STATIC INT32 ConsoleCtrlCaptureLine(CONSOLE_CB *consoleCB)
{
struct termios consoleTermios;
struct termios consoleTermios = {0};
UINT32 intSave;
LOS_SpinLockSave(&g_consoleSpin, &intSave);
......@@ -185,7 +185,7 @@ STATIC INT32 ConsoleCtrlCaptureLine(CONSOLE_CB *consoleCB)
STATIC INT32 ConsoleCtrlCaptureChar(CONSOLE_CB *consoleCB)
{
struct termios consoleTermios;
struct termios consoleTermios = {0};
UINT32 intSave;
LOS_SpinLockSave(&g_consoleSpin, &intSave);
......@@ -1014,7 +1014,7 @@ STATIC const struct file_operations_vfs g_consoleDevOps = {
STATIC VOID OsConsoleTermiosInit(CONSOLE_CB *consoleCB, const CHAR *deviceName)
{
struct termios consoleTermios;
struct termios consoleTermios = {0};
if ((deviceName != NULL) &&
(strlen(deviceName) == strlen(SERIAL)) &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册