Blob Blame History Raw
commit c474cd3ddfcb2fe68f38745675f4c4d9ef79dfc5
Author: Carl Love <cel@us.ibm.com>
Date:   Tue Mar 27 13:07:37 2018 -0700

    PowerPC: Remove trailing comma in cpu_name.
    
    Will:
    
    I redid the patch as follows per your suggestions.  I was able to get
    on to a system where the issue occurs and test the patch.  The patch
    seems to work fine.
    
                       Carl Love
    
    -----------------------------------------------------------------------
    
    The processor type for some Power 9 systems had a comma after POWER9.
    Remove the comma before returning the string for the CPU.

diff --git a/libop/op_cpu_type.c b/libop/op_cpu_type.c
index feea9487..d2babd18 100644
--- a/libop/op_cpu_type.c
+++ b/libop/op_cpu_type.c
@@ -154,17 +154,17 @@ static char * _get_cpuinfo_cpu_type_line(char * buf, int len, const char * prefi
 			/* if token param 0 then read the whole line else
 			 * first token only. */
 			if (token == 0) {
-				/* Trim trailing whitespace */
+				/* Trim trailing whitespace and commas */
 				end = buf + strlen(buf) - 1;
-				while (isspace(*end))
+				while (isspace(*end) || *end == ',')
 					--end;
 				*(++end) = '\0';
 				break;
 			} else {
 				/* Scan ahead to the end of the token */
-				while (*buf && !isspace(*buf))
+				while (*buf && !(isspace(*buf) || *buf == ','))
 					++buf;
-				/* Trim trailing whitespace */
+				/* Trim trailing whitespace and commas */
 				*buf = '\0';
 				break;
 			}