summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/hddtemp/hddtemp-plugin.c7
-rw-r--r--plugins/ibm-acpi/ibm-acpi-plugin.c3
-rw-r--r--plugins/mbmon/mbmon-plugin.c11
3 files changed, 12 insertions, 9 deletions
diff --git a/plugins/hddtemp/hddtemp-plugin.c b/plugins/hddtemp/hddtemp-plugin.c
index 3df514b..be77b1d 100644
--- a/plugins/hddtemp/hddtemp-plugin.c
+++ b/plugins/hddtemp/hddtemp-plugin.c
@@ -60,11 +60,8 @@ enum {
static gchar buffer[HDDTEMP_OUTPUT_BUFFER_LENGTH];
static const gchar *hddtemp_plugin_query_hddtemp_daemon(GError **error) {
- int sockfd;
- ssize_t n = 1;
guint output_length = 0;
static gboolean first_run = TRUE;
- gchar *pc;
struct sockaddr_in address;
static gint64 previous_query_time;
@@ -80,6 +77,10 @@ static const gchar *hddtemp_plugin_query_hddtemp_daemon(GError **error) {
hddtemp daemon will only actually send a new value if is > 60
seconds */
if (first_run || current_query_time - previous_query_time > G_TIME_SPAN_MINUTE) {
+ int sockfd;
+ ssize_t n;
+ gchar *pc;
+
previous_query_time = current_query_time;
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
diff --git a/plugins/ibm-acpi/ibm-acpi-plugin.c b/plugins/ibm-acpi/ibm-acpi-plugin.c
index f659278..1a7437f 100644
--- a/plugins/ibm-acpi/ibm-acpi-plugin.c
+++ b/plugins/ibm-acpi/ibm-acpi-plugin.c
@@ -50,9 +50,8 @@ enum {
static void ibm_acpi_plugin_setup_manually(GList **sensors) {
- gchar *label;
-
if (g_file_test(IBM_ACPI_TEMPERATURE_FILE, G_FILE_TEST_EXISTS)) {
+ gchar *label;
/* with Ibm_Acpi have 8 fixed sensors, all accessed
from the IBM_ACPI_TEMPERATURE_FILE */
diff --git a/plugins/mbmon/mbmon-plugin.c b/plugins/mbmon/mbmon-plugin.c
index 5caa51b..754b0f6 100644
--- a/plugins/mbmon/mbmon-plugin.c
+++ b/plugins/mbmon/mbmon-plugin.c
@@ -54,9 +54,7 @@ enum {
};
static const gchar *mbmon_plugin_query_mbmon_daemon(GError **error) {
- int sockfd;
- ssize_t n = 1;
- gboolean first_run = FALSE;
+ static gboolean first_run = FALSE;
gint output_length = 0;
gchar *pc;
@@ -76,6 +74,9 @@ static const gchar *mbmon_plugin_query_mbmon_daemon(GError **error) {
/* only query if more than 2 seconds has elapsed,
mbmon daemon will send a new value every 2 seconds */
if (first_run || current_query_time - previous_query_time > 2 * G_TIME_SPAN_SECOND) {
+ int sockfd;
+ ssize_t n;
+
previous_query_time = current_query_time;
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
@@ -135,7 +136,7 @@ static void mbmon_plugin_get_sensors(GList **sensors) {
GError *error = NULL;
const gchar *mbmon_output;
- gchar **output_vector = NULL, **pv, **pv2;
+ gchar **output_vector = NULL, **pv;
mbmon_output = mbmon_plugin_query_mbmon_daemon(&error);
@@ -147,6 +148,8 @@ static void mbmon_plugin_get_sensors(GList **sensors) {
pv = output_vector = g_strsplit(mbmon_output, "\n", -1);
while(pv[0] != NULL) {
+ gchar **pv2;
+
pv2 = g_strsplit(pv[0], ":", -1);
gchar *name, *label;
SensorType type;