diff options
Diffstat (limited to 'modules/devices')
-rw-r--r-- | modules/devices/battery.c | 1 | ||||
-rw-r--r-- | modules/devices/devicetree.c | 1 | ||||
-rw-r--r-- | modules/devices/dmi.c | 1 | ||||
-rw-r--r-- | modules/devices/sensors.c | 1 | ||||
-rw-r--r-- | modules/devices/storage.c | 48 | ||||
-rw-r--r-- | modules/devices/x86/processor.c | 17 | ||||
-rw-r--r-- | modules/devices/x86/x86_data.c | 2 |
7 files changed, 37 insertions, 34 deletions
diff --git a/modules/devices/battery.c b/modules/devices/battery.c index 784a6cc5..7e7bad7b 100644 --- a/modules/devices/battery.c +++ b/modules/devices/battery.c @@ -315,6 +315,7 @@ __scan_battery_apm(void) int c=fscanf(procapm, "%s %s %s 0x%x %s %s %d%%", apm_drv_ver, apm_bios_ver, trash, &ac_bat, trash, trash, &percentage); + if(c!=7) return; fclose(procapm); if (last_time == 0) { diff --git a/modules/devices/devicetree.c b/modules/devices/devicetree.c index 7c798670..7d2749c6 100644 --- a/modules/devices/devicetree.c +++ b/modules/devices/devicetree.c @@ -44,7 +44,6 @@ static gchar *get_node(dtr *dt, char *np) { gchar *nodes = NULL, *props = NULL, *ret = NULL; gchar *tmp = NULL, *pstr = NULL, *lstr = NULL; gchar *dir_path; - gchar *node_path; const gchar *fn; GDir *dir; dtr_obj *node, *child; diff --git a/modules/devices/dmi.c b/modules/devices/dmi.c index af02e6d4..ff483877 100644 --- a/modules/devices/dmi.c +++ b/modules/devices/dmi.c @@ -74,7 +74,6 @@ gboolean dmi_get_info(void) gboolean dmi_succeeded = FALSE; guint i; gchar *value=NULL; - const gchar *vendor; if (dmi_info) { g_free(dmi_info); diff --git a/modules/devices/sensors.c b/modules/devices/sensors.c index 095f0bc4..c14cad2a 100644 --- a/modules/devices/sensors.c +++ b/modules/devices/sensors.c @@ -538,7 +538,6 @@ static void read_sensors_sys_thermal(void) { if ((tz = g_dir_open(path_tz, 0, NULL))) { const gchar *entry; - gchar *temp = g_strdup(""); while ((entry = g_dir_read_name(tz))) { gchar *path = g_strdup_printf("%s/%s/temp", path_tz, entry); diff --git a/modules/devices/storage.c b/modules/devices/storage.c index c0bee0d2..e2ba7892 100644 --- a/modules/devices/storage.c +++ b/modules/devices/storage.c @@ -86,7 +86,7 @@ gboolean __scan_udisks2_devices(void) { udisksa *attrib; gchar *udisks2_storage_list = NULL, *features = NULL, *moreinfo = NULL; gchar *devid, *size, *tmp = NULL, *media_comp = NULL, *ven_tag = NULL; - const gchar *url, *media_label, *alabel, *icon, *media_curr = NULL; + const gchar *media_label, *alabel, *icon, *media_curr = NULL; int n = 0, i, j, m; // http://storaged.org/doc/udisks2-api/latest/gdbus-org.freedesktop.UDisks2.Drive.html#gdbus-property-org-freedesktop-UDisks2-Drive.MediaCompatibility @@ -496,9 +496,9 @@ void __scan_scsi_devices(void) scsi_storage_list = g_strdup(_("\n[SCSI Disks]\n")); int otype = 0; - if (proc_scsi = fopen("/proc/scsi/scsi", "r")) { + if ((proc_scsi = fopen("/proc/scsi/scsi", "r"))) { otype = 1; - } else if (proc_scsi = popen("lsscsi -c", "r")) { + } else if ((proc_scsi = popen("lsscsi -c", "r"))) { otype = 2; } @@ -610,7 +610,7 @@ void __scan_scsi_devices(void) void __scan_ide_devices(void) { FILE *proc_ide; - gchar *device, *model, *media, *pgeometry = NULL, *lgeometry = NULL; + gchar *device, *model=NULL, *media=NULL, *pgeometry = NULL, *lgeometry = NULL; gchar iface; gint n = 0, i = 0, cache, nn = 0; gchar *capab = NULL, *speed = NULL, *driver = NULL, *ide_storage_list; @@ -635,10 +635,11 @@ void __scan_ide_devices(void) char *cc=fgets(buf, 128, proc_ide); fclose(proc_ide); - buf[strlen(buf) - 1] = 0; - - model = g_strdup(buf); + if(cc){ + buf[strlen(buf) - 1] = 0; + model = g_strdup(buf); + } g_free(device); device = g_strdup_printf("/proc/ide/hd%c/media", iface); @@ -650,9 +651,11 @@ void __scan_ide_devices(void) char *c=fgets(buf, 128, proc_ide); fclose(proc_ide); - buf[strlen(buf) - 1] = 0; + if(c){ + buf[strlen(buf) - 1] = 0; - media = g_strdup(buf); + media = g_strdup(buf); + } if (g_str_equal(media, "cdrom")) { /* obtain cd-rom drive information from cdrecord */ GTimer *timer; @@ -717,7 +720,7 @@ void __scan_ide_devices(void) if (g_file_test(device, G_FILE_TEST_EXISTS)) { proc_ide = fopen(device, "r"); if (proc_ide) { - int c=fscanf(proc_ide, "%d", &cache); + if(!fscanf(proc_ide, "%d", &cache)) cache=0; fclose(proc_ide); } else { cache = 0; @@ -732,20 +735,23 @@ void __scan_ide_devices(void) proc_ide = fopen(device, "r"); if (proc_ide) { char *c=fgets(buf, 64, proc_ide); - for (tmp = buf; *tmp; tmp++) { - if (*tmp >= '0' && *tmp <= '9') - break; - } + if(c){ + for (tmp = buf; *tmp; tmp++) { + if (*tmp >= '0' && *tmp <= '9') + break; + } - pgeometry = g_strdup(g_strstrip(tmp)); + pgeometry = g_strdup(g_strstrip(tmp)); + } char *cc=fgets(buf, 64, proc_ide); - for (tmp = buf; *tmp; tmp++) { - if (*tmp >= '0' && *tmp <= '9') - break; - } - lgeometry = g_strdup(g_strstrip(tmp)); - + if(cc){ + for (tmp = buf; *tmp; tmp++) { + if (*tmp >= '0' && *tmp <= '9') + break; + } + lgeometry = g_strdup(g_strstrip(tmp)); + } fclose(proc_ide); } else { pgeometry = g_strdup("Unknown"); diff --git a/modules/devices/x86/processor.c b/modules/devices/x86/processor.c index 4141f051..42f0661a 100644 --- a/modules/devices/x86/processor.c +++ b/modules/devices/x86/processor.c @@ -166,11 +166,11 @@ static gchar *__cache_get_info_as_string(Processor *processor) /* This is not used directly, but creates translatable strings for * the type string returned from /sys/.../cache */ -static const char* cache_types[] = { - NC_("cache-type", /*/cache type, as appears in: Level 1 (Data)*/ "Data"), - NC_("cache-type", /*/cache type, as appears in: Level 1 (Instruction)*/ "Instruction"), - NC_("cache-type", /*/cache type, as appears in: Level 2 (Unified)*/ "Unified") -}; +//static const char* cache_types[] = { +// NC_("cache-type", /*/cache type, as appears in: Level 1 (Data)*/ "Data"), +// NC_("cache-type", /*/cache type, as appears in: Level 1 (Instruction)*/ "Instruction"), +// NC_("cache-type", /*/cache type, as appears in: Level 2 (Unified)*/ "Unified") +//}; static void __cache_obtain_info(Processor *processor) { @@ -257,7 +257,6 @@ static gint cmp_cpufreq_data(cpufreq_data *a, cpufreq_data *b) { } static gint cmp_cpufreq_data_ignore_affected(cpufreq_data *a, cpufreq_data *b) { - gint i = 0; cmp_clocks_test(cpukhz_max); cmp_clocks_test(cpukhz_min); return 0; @@ -267,10 +266,10 @@ gchar *clocks_summary(GSList * processors) { gchar *ret = g_strdup_printf("[%s]\n", _("Clocks")); GSList *all_clocks = NULL, *uniq_clocks = NULL; - GSList *tmp, *l; + GSList *l; Processor *p; cpufreq_data *c, *cur = NULL; - gint cur_count = 0, i = 0; + gint cur_count = 0; /* create list of all clock references */ for (l = processors; l; l = l->next) { @@ -369,7 +368,7 @@ gchar *caches_summary(GSList * processors) GSList *tmp, *l; Processor *p; ProcessorCache *c, *cur = NULL; - gint cur_count = 0, i = 0; + gint cur_count = 0; /* create list of all cache references */ for (l = processors; l; l = l->next) { diff --git a/modules/devices/x86/x86_data.c b/modules/devices/x86/x86_data.c index a2f8d7ca..837985e2 100644 --- a/modules/devices/x86/x86_data.c +++ b/modules/devices/x86/x86_data.c @@ -308,7 +308,7 @@ static const struct flag_to_meaning builtin_tab_flag_meaning[] = { static struct flag_to_meaning *tab_flag_meaning; -static char all_flags[4096] = ""; +//static char all_flags[4096] = ""; static void build_meaning_table_iter(JsonObject *object, const gchar *member_name, |