mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-02 14:23:19 +08:00
Refine console safety validation
This commit is contained in:
@@ -94,9 +94,13 @@ static int console(int argc, char **argv)
|
||||
rt_kprintf("console: can not use device as console: %s\n", argv[2]);
|
||||
return -RT_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
rt_kprintf("console change to %s\n", argv[2]);
|
||||
rt_kprintf("console change to %s\n", argv[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("console already set to %s\n", argv[2]);
|
||||
}
|
||||
|
||||
#ifdef RT_USING_POSIX
|
||||
console_set_iodev(dev);
|
||||
|
||||
+2
-2
@@ -179,7 +179,7 @@ static rt_err_t _console_get_open_flags(rt_device_t device, rt_uint16_t *oflag)
|
||||
{
|
||||
if (device->flag & (RT_DEVICE_FLAG_INT_TX | RT_DEVICE_FLAG_DMA_TX))
|
||||
{
|
||||
console_oflag = (device->flag & RT_DEVICE_OFLAG_RDWR) |
|
||||
console_oflag = (device->flag & RT_DEVICE_FLAG_RDWR) |
|
||||
(device->flag & (RT_DEVICE_FLAG_INT_TX | RT_DEVICE_FLAG_DMA_TX)) |
|
||||
RT_DEVICE_FLAG_STREAM;
|
||||
}
|
||||
@@ -187,7 +187,7 @@ static rt_err_t _console_get_open_flags(rt_device_t device, rt_uint16_t *oflag)
|
||||
{
|
||||
LOG_W("refuse to set device %.*s as console: missing console-safe output support",
|
||||
RT_NAME_MAX, device->parent.name);
|
||||
return result;
|
||||
return -RT_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user