Raymond Toy pushed to branch issue-120-software-type-in-c at cmucl / cmucl
Commits:
-
51d4f25b
by Raymond Toy at 2022-09-02T16:00:01-07:00
1 changed file:
Changes:
... | ... | @@ -740,19 +740,15 @@ os_software_version() |
740 | 740 | int version_length;
|
741 | 741 | #if defined(UNAME_RELEASE_AND_VERSION)
|
742 | 742 | version_length = strlen(uts.release) + strlen(uts.version) + 2;
|
743 | -#else
|
|
744 | - version_length = strlen(uts.version) + 1;
|
|
745 | -#endif
|
|
746 | 743 | version = malloc(version_length);
|
747 | 744 | if (version) {
|
748 | -#if defined(UNAME_RELEASE_AND_VERSION)
|
|
749 | 745 | strcpy(version, uts.release);
|
750 | 746 | strcat(version, " ");
|
751 | 747 | strcat(version, uts.version);
|
748 | + }
|
|
752 | 749 | #else
|
753 | - strcpy(version, uts.version);
|
|
750 | + version = strdup(uts.version);
|
|
754 | 751 | #endif
|
755 | - }
|
|
756 | 752 | }
|
757 | 753 | |
758 | 754 | return version;
|
... | ... | @@ -768,10 +764,7 @@ os_software_type() |
768 | 764 |
|
769 | 765 | status = uname(&uts);
|
770 | 766 | if (status == 0) {
|
771 | - os_name = malloc(strlen(uts.sysname) + 1);
|
|
772 | - if (os_name) {
|
|
773 | - strcpy(os_name, uts.sysname);
|
|
774 | - }
|
|
767 | + os_name = strdup(uts.sysname);
|
|
775 | 768 | }
|
776 | 769 | |
777 | 770 | return os_name;
|