File 0004-fix-printf-format.patch of Package sblim-cmpi-smbios
From cf08d6e4b2a58d994b81681fead66d5abb36edd6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@gmail.com>
Date: Fri, 21 Feb 2025 19:11:36 +0100
Subject: [PATCH 4/5] fix printf format
---
dmiinfo.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/dmiinfo.c b/dmiinfo.c
index 8ef413f..66a1907 100644
--- a/dmiinfo.c
+++ b/dmiinfo.c
@@ -3,8 +3,8 @@
*
* (C) Copyright IBM Corp. 2003
*
- * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE
- * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
+ * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE
+ * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
* CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
*
* You can obtain a current copy of the Common Public License from
@@ -17,9 +17,9 @@
*
* Description: Implementation of SMBIOS/DMI Resource Access.
* BIOS and System Information is retrieved by scanning the
- * SMBIOS blocks pointed to by the DMI anchor. Works on
+ * SMBIOS blocks pointed to by the DMI anchor. Works on
* x86 architectures only!
- *
+ *
*/
#include "dmiinfo.h"
@@ -37,7 +37,7 @@ static DMI_BIOSFEATURE *biosfeat = NULL;
static DMI_BIOSELEMENT *bioselem = NULL;
static DMI_HWSECURITY *hwsecurity = NULL;
-static void fillinstruct(struct DMI_HDR * dmih, int num);
+static void fillinstruct(struct DMI_HDR * dmih, int num);
/*
@@ -57,7 +57,7 @@ void cimdmi_init()
size_t pagesz = getpagesize();
unsigned offbios = 0xe0000, offsmbios;
size_t bioslen = 0x20000;
-
+
if (memfile < 0 ) {
perror("Error opening /dev/mem");
cimdmi_term();
@@ -71,7 +71,7 @@ void cimdmi_init()
/* find DMI anchor */
for (dmif=biosptr;(void*)dmif<(biosptr+bioslen);dmif++) {
if (memcmp("_DMI_",dmif->dmi_sig,5)==0) {
- printf("DMI Signature found at %08x\n",
+ printf("DMI Signature found at %08lx\n",
(void*)dmif-biosptr+offbios);
printf("SMBIOS Structures reside at %08x\n",
dmif->dmi_base);
@@ -87,7 +87,7 @@ void cimdmi_init()
smbiosptr = mmap(NULL,dmif->dmi_len + dmif->dmi_base - offsmbios,
PROT_READ,MAP_SHARED, memfile,offsmbios);
if (smbiosptr == MAP_FAILED) {
- perror ("Error mapping /dev/mem SMBIOS");
+ perror ("Error mapping /dev/mem SMBIOS");
cimdmi_term();
} else {
dmih = dmif->dmi_base - offsmbios + smbiosptr;
@@ -96,12 +96,12 @@ void cimdmi_init()
}
}
}
- if (smbiosptr)
+ if (smbiosptr)
munmap(smbiosptr,dmif->dmi_len + dmif->dmi_base - offsmbios);
- if (biosptr)
+ if (biosptr)
munmap(biosptr,bioslen);
- if (memfile > 0)
- close(memfile);
+ if (memfile > 0)
+ close(memfile);
} else {
cimdmi_term();
}
@@ -177,7 +177,7 @@ static void * nexthdr(struct DMI_HDR *dmih, struct DMI_STRING_MAP *dmis)
int i;
memset(dmis,0,sizeof(struct DMI_STRING_MAP));
dmis->dmi_string[0]="unknown";
- if (stringbase[0]==0 && stringbase[1]==0)
+ if (stringbase[0]==0 && stringbase[1]==0)
return stringbase + 2;
for (i=1;*stringbase != 0 && i < 256; i++) {
dmis->dmi_string[i] = stringbase;
@@ -213,7 +213,7 @@ static void fillinstruct(struct DMI_HDR * dmih, int num)
switch(dmih->dmi_type) {
case 0:
/* bios */
- biosinfo = (void*)dmih + sizeof(struct DMI_HDR);
+ biosinfo = (void*)dmih + sizeof(struct DMI_HDR);
bioselem->dmi_Name=strdup("BIOS");
sprintf(cvbuf,"%04x",dmih->dmi_handle);
bioselem->dmi_SWEID=strdup(cvbuf);
@@ -228,7 +228,7 @@ static void fillinstruct(struct DMI_HDR * dmih, int num)
&date.tm_mday,
&date.tm_year);
/* perform date fixups */
- if (date.tm_year>1900)
+ if (date.tm_year>1900)
date.tm_year-=1900;
date.tm_mon-=1;
/* making up time portion as needed for CIM DateTime */
@@ -239,7 +239,7 @@ static void fillinstruct(struct DMI_HDR * dmih, int num)
break;
case 1:
/* system */
- sysinfo = (void*)dmih + sizeof(struct DMI_HDR);
+ sysinfo = (void*)dmih + sizeof(struct DMI_HDR);
biosprod->dmi_Vendor=
strdup(dmis.dmi_string[sysinfo->system_manufacturer_idx]);
biosprod->dmi_Name=strdup(dmis.dmi_string[sysinfo->system_product_idx]);
@@ -255,7 +255,7 @@ static void fillinstruct(struct DMI_HDR * dmih, int num)
break;
case 24:
/* hardware security */
- secinfo = (void*)dmih + sizeof(struct DMI_HDR);
+ secinfo = (void*)dmih + sizeof(struct DMI_HDR);
hwsecurity->dmi_Name=strdup("HW Security");
hwsecurity->dmi_PowerOnPasswordState=secinfo->hwsecurity_setting >> 6;
hwsecurity->dmi_AdminPasswordState=secinfo->hwsecurity_setting >> 2;
@@ -264,7 +264,7 @@ static void fillinstruct(struct DMI_HDR * dmih, int num)
break;
}
dmih=dmihn;
- }
+ }
/* fill in fixed items */
bioselem->dmi_SWEState=2; /* always installed */
bioselem->dmi_TargetOS=36;/* Linux, what else */
--
2.48.1