summaryrefslogtreecommitdiff
path: root/plugins/hddtemp
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-12-21 15:39:17 +0100
committerraveit65 <[email protected]>2020-12-28 17:22:27 +0100
commit9bc69fd715b8bb45c0c45a27c71ce2cc49b0c7d3 (patch)
tree09b866afe25a5010e01b5f13b8d353f0d1a27bb0 /plugins/hddtemp
parent80dffdc6078fd319c5f31248f3896b192d773a60 (diff)
downloadmate-sensors-applet-9bc69fd715b8bb45c0c45a27c71ce2cc49b0c7d3.tar.bz2
mate-sensors-applet-9bc69fd715b8bb45c0c45a27c71ce2cc49b0c7d3.tar.xz
Remove cppcheck warnings about the variable scope can be reduced
Diffstat (limited to 'plugins/hddtemp')
-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) {