summaryrefslogtreecommitdiff
path: root/plugins/hddtemp/hddtemp-plugin.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/hddtemp/hddtemp-plugin.c')
-rw-r--r--plugins/hddtemp/hddtemp-plugin.c7
1 files changed, 4 insertions, 3 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) {