about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-03-06 19:17:02 +0100
committerptitSeb <sebastien.chev@gmail.com>2023-03-06 19:17:02 +0100
commitde82f0727755b04818316abc479d265d80d69a5e (patch)
tree4324a606e83ac84b95e281d54c2db9c358808c47 /src
parent0c8e0b67084c96c9482494ffbf9fdd04a0b65c4c (diff)
downloadbox64-de82f0727755b04818316abc479d265d80d69a5e.tar.gz
box64-de82f0727755b04818316abc479d265d80d69a5e.zip
Added some special case to the CPU Name grabbing
Diffstat (limited to 'src')
-rwxr-xr-xsrc/wrapped/wrappedlibc.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c
index ea532c7c..35f6d0ed 100755
--- a/src/wrapped/wrappedlibc.c
+++ b/src/wrapped/wrappedlibc.c
@@ -1459,7 +1459,7 @@ int getNCpu()
 
 const char* getCpuName()
 {
-    static char name[200] = "Unknown";
+    static char name[200] = "Unknown CPU";
     static int done = 0;
     if(done)
         return name;
@@ -1470,14 +1470,16 @@ const char* getCpuName()
         ssize_t s = fread(tmp, 1, 200, f);
         pclose(f);
         if(s>0) {
-            // worked!
-            // trim ending
-            while(strlen(tmp) && tmp[strlen(tmp)-1]=='\n')
-                tmp[strlen(tmp)-1] = 0;
-            // incase multiple cpu type are present, there will be multiple lines
-            while(strchr(tmp, '\n'))
-                *strchr(tmp,'\n') = ' ';
-            strncpy(name, tmp, 199);
+            // worked! (unless it's saying "lscpu: command not found" or something like that)
+            if(!strstr(tmp, "lscpu")) {
+                // trim ending
+                while(strlen(tmp) && tmp[strlen(tmp)-1]=='\n')
+                    tmp[strlen(tmp)-1] = 0;
+                // incase multiple cpu type are present, there will be multiple lines
+                while(strchr(tmp, '\n'))
+                    *strchr(tmp,'\n') = ' ';
+                strncpy(name, tmp, 199);
+            }
             return name;
         }
     }