From b2290e4fd97974753fff500643c8160f477d55fc Mon Sep 17 00:00:00 2001 From: Yan Chen Date: Fri, 23 Nov 2018 01:47:44 +0800 Subject: [PATCH] fix the wrong code to set the terminate char Description: In mtce/src/hwmon/hwmonThreads.cpp, line 266: ++dst_ptr = '\0' ; should be modified as *(++dst_ptr) = '\0' ; Otherwise the code is useless and will generate a compile error in higher version gcc. Reproduce: Compile the mcte code with gcc 8.2.1 will cause a compile error. And after the fix, the error is gone. Closes-Bug: 1804599 Change-Id: I25df255fb14aa3d96c62927eeb7d3e23ae29af2b Signed-off-by: Yan Chen --- mtce/src/hwmon/hwmonThreads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mtce/src/hwmon/hwmonThreads.cpp b/mtce/src/hwmon/hwmonThreads.cpp index 3615ed7b..072656db 100644 --- a/mtce/src/hwmon/hwmonThreads.cpp +++ b/mtce/src/hwmon/hwmonThreads.cpp @@ -263,7 +263,7 @@ void _get_field ( char * src_ptr , int field, char * dst_ptr ) for ( dst_ptr-- ; *dst_ptr == ' ' ; dst_ptr-- ) { *dst_ptr = '\0' ; } /* terminate the line after the last real non-space char */ - ++dst_ptr = '\0' ; + *(++dst_ptr) = '\0' ; return ;