mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 04:19:37 +08:00
procfs/heapcheck:fix bug,aviod '\n' to 0
The lines will end with \n to prevent atoi('\n') from always being 0. It is recommended to check the first byte directly.
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
@@ -966,12 +966,12 @@ static ssize_t proc_heapcheck_write(FAR struct proc_file_s *procfile,
|
||||
FAR const char *buffer,
|
||||
size_t buflen, off_t offset)
|
||||
{
|
||||
switch (atoi(buffer))
|
||||
switch (buffer[0])
|
||||
{
|
||||
case 0:
|
||||
case '0':
|
||||
tcb->flags &= ~TCB_FLAG_HEAP_CHECK;
|
||||
break;
|
||||
case 1:
|
||||
case '1':
|
||||
tcb->flags |= TCB_FLAG_HEAP_CHECK;
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user