Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37858421
en ru br
ALT Linux repos
S:B.02.19.2-alt2.1
5.0: 2.13-alt2
4.1: 2.12-alt1
4.0: 2.10-alt1
3.0: 2.05-alt1

Group :: System/Kernel and hardware
RPM: lshw

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: lshw-fix-mmc.patch
Download


From 2524bb3def3009e53a78e600bbea2c4639dc1e99 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Fri, 24 Apr 2020 15:02:44 +0200
Subject: [PATCH] Fix type used for read to ssize_t.
Function declaration:
ssize_t read(int fd, void *buf, size_t count);
With size_t the following expression is always true:
while ((count = read(cpuinfo, buffer, sizeof(buffer))) > 0)
and bad things happen.
---
 src/core/cpuinfo.cc | 2 +-
 src/core/osutils.cc | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/core/cpuinfo.cc b/src/core/cpuinfo.cc
index eceb83a..3dbdd0c 100644
--- a/src/core/cpuinfo.cc
+++ b/src/core/cpuinfo.cc
@@ -589,7 +589,7 @@ bool scan_cpuinfo(hwNode & n)
   if (core)
   {
     char buffer[1024];
-    size_t count;
+    ssize_t count;
     string cpuinfo_str = "";
     string description = "", version = "";
     string plat = platform();
diff --git a/src/core/osutils.cc b/src/core/osutils.cc
index f023a46..a53ed89 100644
--- a/src/core/osutils.cc
+++ b/src/core/osutils.cc
@@ -148,7 +148,7 @@ vector < string > &list)
 {
   char buffer[1024];
   string buffer_str = "";
-  size_t count = 0;
+  ssize_t count = 0;
   data_file fd = file_open(file);
 
   if (file_open_error(fd))
@@ -174,7 +174,7 @@ const string & def)
   if (fd >= 0)
   {
     char buffer[1024];
-    size_t count = 0;
+    ssize_t count = 0;
 
     memset(buffer, 0, sizeof(buffer));
     result = "";
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin