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:
anjiahao
2025-03-05 15:56:11 +08:00
committed by Xiang Xiao
parent 431cffa5d8
commit 60dc94b909
+3 -3
View File
@@ -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: