aboutsummaryrefslogtreecommitdiff
path: root/modules/devices
diff options
context:
space:
mode:
authorentityfx <artem.solopiy@gmail.com>2020-06-15 00:48:46 +0300
committerLeandro A. F. Pereira <leandro@hardinfo.org>2020-06-14 15:14:23 -0700
commit3ff7143f29e332bee854c5f009cf3be550a29afc (patch)
tree87892c3b5ea12d5ff3751ddd214aa7722cd0f170 /modules/devices
parentda6e48b9338d3b9b1353506898b9ae73c411e926 (diff)
FIxed buffer size, changed copyright headers
Diffstat (limited to 'modules/devices')
-rw-r--r--modules/devices/e2k/processor.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/modules/devices/e2k/processor.c b/modules/devices/e2k/processor.c
index d38eeff7..620e5330 100644
--- a/modules/devices/e2k/processor.c
+++ b/modules/devices/e2k/processor.c
@@ -1,6 +1,6 @@
/*
* HardInfo - Displays System Information
- * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@hardinfo.org>
+ * Copyright (C) 2020 EntityFX <artem.solopiy@gmail.com> and MCST Elbrus Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -238,25 +238,18 @@ gchar *caches_summary(GSList * processors)
return ret;
}
-
-#define PROC_SCAN_READ_BUFFER_SIZE 1024
GSList *processor_scan(void)
{
GSList *procs = NULL, *l = NULL;
Processor *processor = NULL;
FILE *cpuinfo;
- gchar *buffer;
+ gchar buffer[1024];
- buffer = g_malloc(PROC_SCAN_READ_BUFFER_SIZE);
cpuinfo = fopen(PROC_CPUINFO, "r");
if (!cpuinfo)
return NULL;
- while (fgets(buffer, PROC_SCAN_READ_BUFFER_SIZE, cpuinfo)) {
- int rlen = strlen(buffer);
- if (rlen >= PROC_SCAN_READ_BUFFER_SIZE - 1) {
- fprintf(stderr, "Warning: truncated a line (probably flags list) longer than %d bytes while reading %s.\n", PROC_SCAN_READ_BUFFER_SIZE, PROC_CPUINFO);
- }
+ while (fgets(buffer, 1024, cpuinfo)) {
gchar **tmp = g_strsplit(buffer, ":", 2);
if (!tmp[1] || !tmp[0]) {
g_strfreev(tmp);