mirror of
https://gitee.com/openharmony/startup_init
synced 2024-11-23 16:20:00 +00:00
Description:fix ioctl console failed
Feature or Bugfix:Bugfix Binary Source: No Signed-off-by: cat <chenjinxiang3@huawei.com>
This commit is contained in:
parent
60c84f94f1
commit
274a87195b
@ -595,13 +595,13 @@ static void RedirectStdio(int fd)
|
||||
#endif
|
||||
|
||||
#ifndef __LITEOS_M__
|
||||
static int OpenStdioDevice(const char *dev)
|
||||
static int OpenStdioDevice(const char *dev, int flag)
|
||||
{
|
||||
setsid();
|
||||
WaitForFile(dev, WAIT_MAX_SECOND);
|
||||
int fd = open(dev, O_RDWR);
|
||||
if (fd >= 0) {
|
||||
ioctl(fd, TIOCSCTTY, 0);
|
||||
ioctl(fd, TIOCSCTTY, flag);
|
||||
RedirectStdio(fd);
|
||||
if (fd > 2) {
|
||||
close(fd);
|
||||
@ -616,14 +616,14 @@ static int OpenStdioDevice(const char *dev)
|
||||
int OpenConsole(void)
|
||||
{
|
||||
#ifndef __LITEOS_M__
|
||||
return OpenStdioDevice("/dev/console");
|
||||
return OpenStdioDevice("/dev/console", 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
int OpenKmsg(void)
|
||||
{
|
||||
#ifndef __LITEOS_M__
|
||||
return OpenStdioDevice("/dev/kmsg");
|
||||
return OpenStdioDevice("/dev/kmsg", 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user