[Git][cmucl/cmucl][issue-120-software-type-in-c] Return "Unknown" if uname fails

Raymond Toy (@rtoy) gitlab at common-lisp.net
Sat Mar 25 15:03:41 UTC 2023



Raymond Toy pushed to branch issue-120-software-type-in-c at cmucl / cmucl


Commits:
4abd7935 by Raymond Toy at 2023-03-25T08:02:09-07:00
Return "Unknown" if uname fails

Remove the check for NULL from os_software_version since that can't
happen anymore.

- - - - -


2 changed files:

- src/code/misc.lisp
- src/lisp/os-common.c


Changes:

=====================================
src/code/misc.lisp
=====================================
@@ -101,8 +101,7 @@
 			 (alien:alien-funcall
 			  (alien:extern-alien "os_software_version"
 					      (function (alien:* c-call:c-string)))))
-		   (unless (zerop (sap-int (alien:alien-sap version)))
-		     (alien:cast version c-call:c-string))))))
+		   (alien:cast version c-call:c-string)))))
     *software-version*))
 
 (defvar *short-site-name* nil


=====================================
src/lisp/os-common.c
=====================================
@@ -828,19 +828,20 @@ os_software_version(void)
 
     int status;
 
+    strcpy(result, "Unknown");
+
     status = uname(&uts);
-    if (status != 0) {
-        return NULL;
-    }
+    if (status == 0) {
     
 #if defined(UNAME_RELEASE_AND_VERSION)
-    strcpy(result, uts.release);
-    strcat(result, " ");
-    strcat(result, uts.version);
+      strcpy(result, uts.release);
+      strcat(result, " ");
+      strcat(result, uts.version);
 #else
-    strcpy(result, uts.version);
+      strcpy(result, uts.version);
 #endif
-
+    }
+    
     return result;
 }
 #undef UNAME_RELEASE_AND_VERSION



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/4abd79359ba5607a1351f224f2d8ac2b5dc54796

-- 
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/4abd79359ba5607a1351f224f2d8ac2b5dc54796
You're receiving this email because of your account on gitlab.common-lisp.net.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20230325/1833dfb0/attachment-0001.html>


More information about the cmucl-cvs mailing list