From fd0a6914716d12567d2680fbb930f6c8f391b010 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Sun, 22 Apr 2018 01:00:08 +0200 Subject: [PATCH] Fix detecting the sysctl name on {Free,Net}BSD --- src/applets/cpufreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/applets/cpufreq.c b/src/applets/cpufreq.c index 5f78438..08a792b 100644 --- a/src/applets/cpufreq.c +++ b/src/applets/cpufreq.c @@ -89,6 +89,7 @@ static Cpufreq * _cpufreq_init(PanelAppletHelper * helper, GtkWidget ** widget) char freq[256]; size_t freqsize = sizeof(freq); char const * p; + char const * q; /* detect the correct sysctl */ if(sysctlbyname("hw.clockrate", &freq, &freqsize, NULL, 0) == 0) @@ -128,7 +129,7 @@ static Cpufreq * _cpufreq_init(PanelAppletHelper * helper, GtkWidget ** widget) panel_window_get_icon_size(helper->window)); gtk_box_pack_start(GTK_BOX(cpufreq->hbox), image, FALSE, TRUE, 0); cpufreq->max = atoll(freq); - cpufreq->min = (p = strrchr(freq, ' ')) != NULL ? atoll(p) + cpufreq->min = (q = strrchr(freq, ' ')) != NULL ? atoll(q) : cpufreq->max; cpufreq->current = -1; cpufreq->step = 1;