mirror of
https://github.com/openharmony/startup_init_lite.git
synced 2026-07-19 17:07:55 -04:00
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
@@ -31,12 +32,12 @@ static int SendCmd(int cmd, unsigned long arg)
|
||||
if (fd != -1) {
|
||||
int ret = ioctl(fd, cmd, arg);
|
||||
if (ret == -1) {
|
||||
INIT_LOGE("[Init] [ERR] %s!", strerror(errno));
|
||||
INIT_LOGE("[Init] [ERR] %d!", errno);
|
||||
}
|
||||
close(fd);
|
||||
return ret;
|
||||
}
|
||||
INIT_LOGE("[Init] [ERR] %s!", strerror(errno));
|
||||
INIT_LOGE("[Init] [ERR] %d!", errno);
|
||||
return fd;
|
||||
}
|
||||
|
||||
@@ -45,7 +46,7 @@ int InitListen(unsigned long eventMask, unsigned int wait)
|
||||
QuickstartListenArgs args;
|
||||
args.wait = wait;
|
||||
args.events = eventMask;
|
||||
return SendCmd(QUICKSTART_LISTEN, (unsigned long)&args);
|
||||
return SendCmd(QUICKSTART_LISTEN, (uintptr_t)&args);
|
||||
}
|
||||
|
||||
int NotifyInit(unsigned long event)
|
||||
|
||||
@@ -71,9 +71,8 @@ void InitLog(const char *tag, InitLogLevel logLevel, const char *fileName, int l
|
||||
return;
|
||||
}
|
||||
|
||||
time_t logTime;
|
||||
time(&logTime);
|
||||
struct tm *t = gmtime(&logTime);
|
||||
time_t second = time(0);
|
||||
struct tm *t = localtime(&second);
|
||||
if (t == NULL) {
|
||||
printf("time is NULL.\n");
|
||||
return;
|
||||
|
||||
@@ -329,10 +329,14 @@ static void DoCopy(const char* cmdContent)
|
||||
out:
|
||||
FreeCmd(&ctx);
|
||||
ctx = NULL;
|
||||
close(srcFd);
|
||||
srcFd = -1;
|
||||
close(dstFd);
|
||||
dstFd = -1;
|
||||
if (srcFd >= 0) {
|
||||
close(srcFd);
|
||||
srcFd = -1;
|
||||
}
|
||||
if (dstFd >= 0) {
|
||||
close(dstFd);
|
||||
dstFd = -1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user