From a8ccc2aa89c78108566c67b9e853797ea451f9c8 Mon Sep 17 00:00:00 2001 From: hwspeedy Date: Fri, 24 May 2024 10:20:25 +0200 Subject: FIX GCC Warnings, added more checking to gcc flags --- modules/benchmark.c | 3 --- modules/benchmark/bench_results.c | 1 - modules/benchmark/bench_util.c | 2 +- modules/benchmark/blowfish2.c | 4 ++-- modules/benchmark/fft.c | 5 +--- modules/benchmark/fftbench.c | 2 +- modules/benchmark/guibench.c | 1 - modules/benchmark/iperf3.c | 3 +-- modules/benchmark/raytrace.c | 2 -- modules/benchmark/sha1.c | 6 ++--- modules/benchmark/sysbench.c | 12 +++++----- modules/benchmark/zlib.c | 5 ++-- modules/computer/alsa.c | 6 ++--- modules/computer/boots.c | 2 +- modules/computer/display.c | 1 - modules/computer/modules.c | 4 ++-- modules/computer/os.c | 1 - modules/computer/ubuntu_flavors.c | 2 +- modules/computer/uptime.c | 2 +- modules/devices.c | 1 - modules/devices/battery.c | 1 + modules/devices/devicetree.c | 1 - modules/devices/dmi.c | 1 - modules/devices/sensors.c | 1 - modules/devices/storage.c | 48 ++++++++++++++++++++++----------------- modules/devices/x86/processor.c | 17 +++++++------- modules/devices/x86/x86_data.c | 2 +- modules/network.c | 7 +++--- modules/network/net.c | 4 ++-- modules/network/samba.c | 3 +-- 30 files changed, 69 insertions(+), 81 deletions(-) (limited to 'modules') diff --git a/modules/benchmark.c b/modules/benchmark.c index 79662c06..441dc1ac 100644 --- a/modules/benchmark.c +++ b/modules/benchmark.c @@ -245,7 +245,6 @@ bench_value benchmark_parallel_for(gint n_threads, gpointer callback, gpointer callback_data) { - gchar *temp; int cpu_procs, cpu_cores, cpu_threads, cpu_nodes; guint iter_per_thread=1, iter, thread_number = 0; GSList *threads = NULL, *t; @@ -409,7 +408,6 @@ static GSList *benchmark_include_results_json(const gchar *path, { JsonParser *parser; JsonNode *root; - bench_result *this_machine = NULL; GSList *result_list = NULL; GError *error=NULL; @@ -747,7 +745,6 @@ static gchar *get_benchmark_results(gsize *len) void (*scan_callback)(gboolean); JsonBuilder *builder; JsonGenerator *generator; - JsonNode *root; bench_machine *this_machine; gchar *out; guint i; diff --git a/modules/benchmark/bench_results.c b/modules/benchmark/bench_results.c index e99e8b6e..0b2f182f 100644 --- a/modules/benchmark/bench_results.c +++ b/modules/benchmark/bench_results.c @@ -418,7 +418,6 @@ bench_result *bench_result_benchmarkjson(const gchar *bench_name, { JsonObject *machine; bench_result *b; - gchar *p; if (json_node_get_node_type(node) != JSON_NODE_OBJECT) return NULL; diff --git a/modules/benchmark/bench_util.c b/modules/benchmark/bench_util.c index d9e5bc55..1942f625 100644 --- a/modules/benchmark/bench_util.c +++ b/modules/benchmark/bench_util.c @@ -54,5 +54,5 @@ char *md5_digest_str(const char *data, unsigned int len) { MD5Init(&ctx); MD5Update(&ctx, (guchar *)data, len); MD5Final(digest, &ctx); - return digest_to_str(digest, 16); + return digest_to_str((char *)digest, 16); } diff --git a/modules/benchmark/blowfish2.c b/modules/benchmark/blowfish2.c index 7426bef9..b60dd52c 100644 --- a/modules/benchmark/blowfish2.c +++ b/modules/benchmark/blowfish2.c @@ -30,7 +30,7 @@ static gpointer bfish_exec(const void *in_data, gint thread_number) { - unsigned char key[] = BLOW_KEY; + char key[] = BLOW_KEY; unsigned char *data = NULL; unsigned long data_len = BENCH_DATA_SIZE, i = 0; BLOWFISH_CTX ctx; @@ -38,7 +38,7 @@ static gpointer bfish_exec(const void *in_data, gint thread_number) data = malloc(BENCH_DATA_SIZE); memcpy(data, in_data, BENCH_DATA_SIZE); - Blowfish_Init(&ctx, key, strlen(key)); + Blowfish_Init(&ctx, (guchar *)key, strlen(key)); for(i = 0; i < data_len; i += 8) { Blowfish_Encrypt(&ctx, (unsigned long*)&data[i], (unsigned long*)&data[i+4]); } diff --git a/modules/benchmark/fft.c b/modules/benchmark/fft.c index df643fe2..65ef5c30 100644 --- a/modules/benchmark/fft.c +++ b/modules/benchmark/fft.c @@ -27,9 +27,7 @@ static gpointer fft_for(void *in_data, gint thread_number) { - unsigned int i; FFTBench **benches = (FFTBench **)in_data; - FFTBench *fftbench = (FFTBench *)(benches[thread_number]); fft_bench_run(benches[thread_number]); @@ -42,8 +40,7 @@ benchmark_fft(void) int cpu_procs, cpu_cores, cpu_threads, cpu_nodes; bench_value r = EMPTY_BENCH_VALUE; - int n_cores, i; - gchar *temp; + int i; FFTBench **benches=NULL; shell_view_set_enabled(FALSE); diff --git a/modules/benchmark/fftbench.c b/modules/benchmark/fftbench.c index a531e276..bfd42b98 100644 --- a/modules/benchmark/fftbench.c +++ b/modules/benchmark/fftbench.c @@ -61,7 +61,7 @@ static double random_double() static const int N = 100; static const int NM1 = 99; // N - 1 -static const int NP1 = 101; // N + 1 +//static const int NP1 = 101; // N + 1 static void lup_decompose(FFTBench *fftbench) { diff --git a/modules/benchmark/guibench.c b/modules/benchmark/guibench.c index 54b10493..dc43b8fe 100644 --- a/modules/benchmark/guibench.c +++ b/modules/benchmark/guibench.c @@ -129,7 +129,6 @@ gboolean on_draw (GtkWidget *widget, GdkEventExpose *event, gpointer data) { double guibench(double *frameTime, int *frameCount) { GtkWindow * window; - cairo_t *cr; //Get DarkMode state from system g_object_get(gtk_settings_get_default(), "gtk-application-prefer-dark-theme", &darkmode, NULL); diff --git a/modules/benchmark/iperf3.c b/modules/benchmark/iperf3.c index 43e40627..43b98df4 100644 --- a/modules/benchmark/iperf3.c +++ b/modules/benchmark/iperf3.c @@ -32,7 +32,7 @@ static int iperf3_version() { if (spawned) { ret = 0; p = out; - while(next_nl = strchr(p, '\n')) { + while((next_nl = strchr(p, '\n'))) { *next_nl = 0; /* version */ mc = sscanf(p, "iperf %d.%d", &v1, &v2); @@ -75,7 +75,6 @@ static double _get_double(JsonParser *j, const char* path) { static bench_value iperf3_client() { bench_value ret = EMPTY_BENCH_VALUE; - int v1 = 0, v2 = 0, v3 = 0, mc = 0; gboolean spawned; gchar *out, *err; GError *e = NULL; diff --git a/modules/benchmark/raytrace.c b/modules/benchmark/raytrace.c index bddc3232..b991722e 100644 --- a/modules/benchmark/raytrace.c +++ b/modules/benchmark/raytrace.c @@ -26,8 +26,6 @@ void fbench(); /* fbench.c */ static gpointer parallel_raytrace(void *in_data, gint thread_number) { - unsigned int i; - fbench(); return NULL; diff --git a/modules/benchmark/sha1.c b/modules/benchmark/sha1.c index 8cbf0f6a..1ea0b1c1 100644 --- a/modules/benchmark/sha1.c +++ b/modules/benchmark/sha1.c @@ -234,9 +234,9 @@ void SHA1Final(guchar digest[20], SHA1_CTX * context) /* Wipe variables */ i = j = 0; memset(context->buffer, 0, 64); - memset(context->state, 0, 20); - memset(context->count, 0, 8); - memset(&finalcount, 0, 8); + memset(context->state, 0, 20*sizeof(guint32)); + memset(context->count, 0, 2*sizeof(guint32)); + memset(&finalcount, 0, sizeof(finalcount)); #ifdef SHA1HANDSOFF /* make SHA1Transform overwrite it's own static vars */ SHA1Transform(context->state, context->buffer); #endif diff --git a/modules/benchmark/sysbench.c b/modules/benchmark/sysbench.c index 5c45831d..a8e9a6ca 100644 --- a/modules/benchmark/sysbench.c +++ b/modules/benchmark/sysbench.c @@ -48,7 +48,7 @@ int sysbench_version() { if (spawned) { ret = 0; p = out; - while(next_nl = strchr(p, '\n')) { + while((next_nl = strchr(p, '\n'))) { *next_nl = 0; /* version */ mc = sscanf(p, "sysbench %d.%d.%d", &v1, &v2, &v3); @@ -100,7 +100,7 @@ static gboolean sysbench_run(struct sysbench_ctx *ctx, int expecting_version) { g_free(cmd_line); if (spawned) { p = out; - while(next_nl = strchr(p, '\n')) { + while((next_nl = strchr(p, '\n'))) { *next_nl = 0; if (strstr(p, "Usage:")) { @@ -118,7 +118,7 @@ static gboolean sysbench_run(struct sysbench_ctx *ctx, int expecting_version) { } /* total_time */ - if (pp = strstr(p, "total time:")) { + if ((pp = strstr(p, "total time:"))) { pp = strchr(pp, ':') + 1; ctx->r.elapsed_time = strtof(pp, NULL); } @@ -126,7 +126,7 @@ static gboolean sysbench_run(struct sysbench_ctx *ctx, int expecting_version) { /* result */ if (SEQ(ctx->test, "memory") ) { // 57894.30 MiB transferred (5787.59 MiB/sec) - if (pp = strstr(p, " transferred (")) { + if ((pp = strstr(p, " transferred ("))) { pp = strchr(pp, '(') + 1; ctx->r.result = strtof(pp, NULL); } @@ -139,7 +139,7 @@ static gboolean sysbench_run(struct sysbench_ctx *ctx, int expecting_version) { // total number of events: 873 /* should already have "total time:" */ - if (pp = strstr(p, " total number of events:")) { + if ((pp = strstr(p, " total number of events:"))) { pp = strchr(pp, ':') + 1; ctx->r.result = strtof(pp, NULL); ctx->r.result /= ctx->r.elapsed_time; @@ -147,7 +147,7 @@ static gboolean sysbench_run(struct sysbench_ctx *ctx, int expecting_version) { } if (ctx->r.revision >= 1000000) { // events per second: 1674.97 - if (pp = strstr(p, " events per second:")) { + if ((pp = strstr(p, " events per second:"))) { pp = strchr(pp, ':') + 1; ctx->r.result = strtof(pp, NULL); } diff --git a/modules/benchmark/zlib.c b/modules/benchmark/zlib.c index 2045969f..3f2c1291 100644 --- a/modules/benchmark/zlib.c +++ b/modules/benchmark/zlib.c @@ -35,15 +35,14 @@ static unsigned int zlib_errors = 0; static gpointer zlib_for(void *in_data, gint thread_number) { - char *compressed; + guchar *compressed; uLong bound = compressBound(BENCH_DATA_SIZE); - unsigned int i; compressed = malloc(bound); if (!compressed) return NULL; - char uncompressed[BENCH_DATA_SIZE]; + guchar uncompressed[BENCH_DATA_SIZE]; uLong compressedBound = bound; uLong destBound = sizeof(uncompressed); diff --git a/modules/computer/alsa.c b/modules/computer/alsa.c index de20a0ad..3380c003 100644 --- a/modules/computer/alsa.c +++ b/modules/computer/alsa.c @@ -51,8 +51,8 @@ computer_get_alsainfo(void) return NULL; ai = g_new0(AlsaInfo, 1); - - while (fgets(buffer, 128, cards)) { + char *c=(char *)1; + while (c && (c=fgets(buffer, 128, cards))) { gchar **tmp; ac = g_new0(AlsaCard, 1); @@ -63,7 +63,7 @@ computer_get_alsainfo(void) ai->cards = g_slist_append(ai->cards, ac); g_strfreev(tmp); - char *c=fgets(buffer, 128, cards); /* skip next line */ + c=fgets(buffer, 128, cards); /* skip next line */ } fclose(cards); diff --git a/modules/computer/boots.c b/modules/computer/boots.c index 52c122e4..40827649 100644 --- a/modules/computer/boots.c +++ b/modules/computer/boots.c @@ -41,7 +41,7 @@ scan_boots_real(void) &out, &err, NULL, NULL); if (spawned && out != NULL) { p = out; - while(next_nl = strchr(p, '\n')) { + while((next_nl = strchr(p, '\n'))) { strend(p, '\n'); if (strstr(p, "system boot")) { s = p; diff --git a/modules/computer/display.c b/modules/computer/display.c index 98cb7bf7..e1b35ad9 100644 --- a/modules/computer/display.c +++ b/modules/computer/display.c @@ -26,7 +26,6 @@ DisplayInfo *computer_get_display(void) { wl_info *wl = get_walyand_info(); xinfo *xi = xinfo_get_info(); xrr_info *xrr = xi->xrr; - glx_info *glx = xi->glx; di->width = di->height = 0; if (xrr->screen_count > 0) { diff --git a/modules/computer/modules.c b/modules/computer/modules.c index e3423ed8..a2e53d8a 100644 --- a/modules/computer/modules.c +++ b/modules/computer/modules.c @@ -227,7 +227,7 @@ static const gchar* get_module_icon(const char *modname, const char *path) return NULL; const gchar *path_no_prefix = path + strlen(kernel_modules_dir); - const size_t path_no_prefix_len = strlen(path_no_prefix); + //const size_t path_no_prefix_len = strlen(path_no_prefix); int i; for (i = 0; modules_icons[i].dir; i++) { @@ -266,7 +266,7 @@ void scan_modules_do(void) { } char *c=fgets(buffer, 1024, lsmod); /* Discards the first line */ - + if(!c) return; //Sort modules while (fgets(buffer, 1024, lsmod)) { list=g_list_prepend(list,g_strdup(buffer)); diff --git a/modules/computer/os.c b/modules/computer/os.c index 0b6bb021..c8bee8d3 100644 --- a/modules/computer/os.c +++ b/modules/computer/os.c @@ -516,7 +516,6 @@ computer_get_os(void) { struct utsname utsbuf; OperatingSystem *os; - int i; os = g_new0(OperatingSystem, 1); diff --git a/modules/computer/ubuntu_flavors.c b/modules/computer/ubuntu_flavors.c index ac67d665..c88dc5ff 100644 --- a/modules/computer/ubuntu_flavors.c +++ b/modules/computer/ubuntu_flavors.c @@ -66,7 +66,7 @@ GSList *ubuntu_flavors_scan(void) { &out, &err, &exit_status, NULL); if (spawned) { p = out; - while(next_nl = strchr(p, '\n')) { + while((next_nl = strchr(p, '\n'))) { strend(p, '\n'); int mc = 0; char pkg[32] = ""; diff --git a/modules/computer/uptime.c b/modules/computer/uptime.c index f213442f..d12d1c2f 100644 --- a/modules/computer/uptime.c +++ b/modules/computer/uptime.c @@ -27,7 +27,7 @@ computer_get_uptime(void) if ((procuptime = fopen("/proc/uptime", "r")) != NULL) { int c=fscanf(procuptime, "%lu", &minutes); - ui->minutes = minutes / 60; + if(c) ui->minutes = minutes / 60; fclose(procuptime); } else { g_free(ui); diff --git a/modules/devices.c b/modules/devices.c index 0c49926f..8bf24d46 100644 --- a/modules/devices.c +++ b/modules/devices.c @@ -292,7 +292,6 @@ gchar *get_storage_devices_simple(void) struct InfoGroup *group; struct InfoField *field; gchar *storage_devs = NULL, *tmp; - const gchar *dev_label, *model_wo_tags; GRegex *regex; regex = g_regex_new ("<.*>", 0, 0, NULL); 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, diff --git a/modules/network.c b/modules/network.c index e89e1b6b..1f40755a 100644 --- a/modules/network.c +++ b/modules/network.c @@ -197,9 +197,10 @@ void scan_route(gboolean reload) if ((route = popen(command_line, "r"))) { /* eat first two lines */ char *c=fgets(buffer, 256, route); - char *cc=fgets(buffer, 256, route); + char *cc=NULL; + if(c) {cc=fgets(buffer, 256, route);} - while (fgets(buffer, 256, route)) { + if(cc) while (fgets(buffer, 256, route)) { buffer[15] = '\0'; buffer[31] = '\0'; buffer[47] = '\0'; @@ -238,7 +239,7 @@ void scan_arp(gboolean reload) /* eat first line */ char *c=fgets(buffer, 256, arp); - while (fgets(buffer, 256, arp)) { + if(c) while (fgets(buffer, 256, arp)) { buffer[15] = '\0'; buffer[58] = '\0'; diff --git a/modules/network/net.c b/modules/network/net.c index 9f5d5cb3..04c20d2a 100644 --- a/modules/network/net.c +++ b/modules/network/net.c @@ -85,7 +85,7 @@ void get_wireless_info(int fd, NetInfo *netinfo) FILE *wrls; char wbuf[256]; struct iwreq wi_req; - int r, trash; + int trash; netinfo->is_wireless = FALSE; @@ -181,7 +181,7 @@ void get_net_info(char *if_name, NetInfo * netinfo) /* IPv4 */ ifr.ifr_addr.sa_family = AF_INET; - strncpy(netinfo->name, if_name, sizeof(netinfo->name)); + memcpy(netinfo->name, if_name, sizeof(netinfo->name)); /* MTU */ strcpy(ifr.ifr_name, if_name); diff --git a/modules/network/samba.c b/modules/network/samba.c index e14742ea..7edcbe0b 100644 --- a/modules/network/samba.c +++ b/modules/network/samba.c @@ -50,7 +50,6 @@ scan_samba(void) void scan_samba_usershares(void) { - FILE *usershare_list; gboolean spawned; int status; gchar *out, *err, *p, *next_nl; @@ -63,7 +62,7 @@ scan_samba_usershares(void) if (spawned && status == 0 && out != NULL) { shell_status_update("Scanning SAMBA user shares..."); p = out; - while(next_nl = strchr(p, '\n')) { + while((next_nl = strchr(p, '\n'))) { cmdline = g_strdup_printf("net usershare info '%s'", strend(p, '\n')); if (hardinfo_spawn_command_line_sync(cmdline, -- cgit v1.2.3