diff --git a/Changelog b/Changelog index b078036..ee52938 100644 --- a/Changelog +++ b/Changelog @@ -38,7 +38,7 @@ GKrellM Changelog * Patch from Gerard Neil: Skip autofs mounts in free disk space polling * Patch from Gerard Neil: Handle cifs as remote filesystem to use longer nfs-timeout polling interval - * Patch from Alexandre Rostovtsev: Explicitely link against gmodule-2.0 + * Patch from Alexandre Rostovtsev: Explicitly link against gmodule-2.0 * Add support for GPU-Z sensor information on Windows * Increase minimum required GLib version to 2.32, some parts of gkrellm use newer GLib API @@ -151,7 +151,7 @@ GKrellM Changelog Use unicode function calls. Use getaddrinfo() on win32. Support CoreTemp application for getting cpu temperatures. - Redo sensor-handling to support multipe sensor backends. + Redo sensor-handling to support multiple sensor backends. Make Proc monitor work and properly count # of logged in users. Mem monitor displays cache bytes. System name shows some new windows versions. diff --git a/README b/README index 84df8ac..b8f59d4 100644 --- a/README +++ b/README @@ -549,7 +549,7 @@ The reasons for this choice are a) efficiency (though it might be possible to open/close /dev/sysmon each time a reading is needed without major performance issue) and b) as of october 2001, there's a bug in the envsys(4) driver which sometimes causes deadlocks when processes try to -access simultaneoulsy /dev/sysmon (see NetBSD PR#14368). A (quick and +access simultaneously /dev/sysmon (see NetBSD PR#14368). A (quick and dirty) workaround for this is to monopolize the driver :) diff --git a/Themes.html b/Themes.html index 9975120..e411ec3 100644 --- a/Themes.html +++ b/Themes.html @@ -719,7 +719,7 @@ krell parameters, frame rendering, etc are made in the gkrellmrc file. Setting these values may have a variable effect on different monitors because the programmer may use the values to differing degrees. For example, margins may affect a label or some text decal but not affect -other text decals because the programmer explicitely centers the decal. +other text decals because the programmer explicitly centers the decal. <p> The possible gkrellmrc lines are listed here. <p> diff --git a/gkrellmd.1 b/gkrellmd.1 index 073a665..032e775 100644 --- a/gkrellmd.1 +++ b/gkrellmd.1 @@ -192,7 +192,7 @@ arguments may be given. If no hosts are specified on the command line or in a gkrellmd.conf file, then all hosts are allowed to connect. The .I hostname -argument may be a text name or a IPv4 or IPv6 +argument may be a text name or an IPv4 or IPv6 dotted notation. For IPv4, the simple subnet pattern x.y.z.* may be used. Also, if .I hostname diff --git a/server/mail.c b/server/mail.c index 83a8a7b..d7929f9 100644 --- a/server/mail.c +++ b/server/mail.c @@ -324,7 +324,7 @@ check_maildir(Mailbox *mbox) | But, new mail arriving (writing mailbox) sets st_mtime while reading | the mailbox (mail program reading) sets st_atime. So the test | st_atime > st_mtime is testing if mbox has been read since last new mail. - | Mail readers may restore st_mtime after writting status. + | Mail readers may restore st_mtime after writing status. | And Netscape mail does status with X-Mozilla-Status: xxxS | where S is bitwise or of status flags: | 1: read 2: replied 4: marked 8: deleted diff --git a/server/main.c b/server/main.c index 8851e13..1c1f22e 100644 --- a/server/main.c +++ b/server/main.c @@ -1124,18 +1124,28 @@ detach_from_terminal(void) #endif /* !defined(WIN32) */ -static void +static int drop_privileges(void) { #if !defined(WIN32) + int r; if (drop_privs.gid > (uid_t)0) { - (void) setgroups((size_t)0, (gid_t*)0); - (void) setgid(drop_privs.gid); + r = setgroups((size_t)0, (gid_t*)0); + if (r != 0) + return r; + r = setgid(drop_privs.gid); + if (r != 0) + return r; } if (drop_privs.uid > (uid_t)0) - (void) setuid(drop_privs.uid); + { + r = setuid(drop_privs.uid); + if (r != 0) + return r; + } #endif + return 0; } @@ -1201,7 +1211,12 @@ gkrellmd_run(gint argc, gchar **argv) make_pidfile(); gkrellm_sys_main_init(); - drop_privileges(); + if (drop_privileges() != 0) + { + g_warning("Failed to drop privileges: %s\n", strerror(errno)); + gkrellm_sys_main_cleanup(); + return 1; + } _GK.start_time = time(0); if (_GK.update_HZ < 1 || _GK.update_HZ > 10) diff --git a/server/monitor.c b/server/monitor.c index 3e3eec9..1a7fa45 100644 --- a/server/monitor.c +++ b/server/monitor.c @@ -2018,7 +2018,7 @@ init_sensors_monitor(void) /* ======================================================= */ static time_t base_uptime, up_seconds; -static gulong up_minutes = -1; +static glong up_minutes = -1; void gkrellm_uptime_set_base_uptime(time_t base) @@ -2029,16 +2029,16 @@ gkrellm_uptime_set_base_uptime(time_t base) static void update_uptime(GkrellmdMonitor *mon, gboolean first_update) { - gint prev_up; + glong prev_up; if (GK.ten_second_tick || up_minutes < 0 || first_update) { prev_up = up_minutes; up_seconds = gkrellm_sys_uptime_read_uptime(); if (up_seconds > 0) - up_minutes = (gint) (up_seconds / 60); + up_minutes = (glong) (up_seconds / 60); else - up_minutes = (gint)(time(0) - _GK.start_time + base_uptime) / 60; + up_minutes = (glong)(time(0) - _GK.start_time + base_uptime) / 60; if (up_minutes != prev_up) gkrellmd_need_serve(mon); } @@ -2050,7 +2050,7 @@ serve_uptime_data(GkrellmdMonitor *mon, gboolean first_serve) gchar buf[128]; gkrellmd_set_serve_name(mon, "uptime"); - snprintf(buf, sizeof(buf), "%lu\n", (gulong) up_minutes); + snprintf(buf, sizeof(buf), "%ld\n", (glong) (up_minutes >= 0 ? up_minutes : 0)); gkrellmd_serve_data(mon, buf); } diff --git a/shared/log.c b/shared/log.c index 44a429c..6d47993 100644 --- a/shared/log.c +++ b/shared/log.c @@ -92,7 +92,7 @@ gkrellm_log_file_cleanup() } static void -gkrellm_log_file_log(GLogLevelFlags log_level, const gchar *message) +gkrellm_log_file_log(G_GNUC_UNUSED GLogLevelFlags log_level, const gchar *message) { time_t raw_time; char *local_time_str; @@ -160,11 +160,11 @@ gkrellm_log_to_terminal(GLogLevelFlags log_level, const gchar *message) //! Handler that receives all the log-messages first static void -gkrellm_log_handler(const gchar *log_domain, GLogLevelFlags log_level, - const gchar *message, gpointer user_data) +gkrellm_log_handler(G_GNUC_UNUSED const gchar *log_domain, GLogLevelFlags log_level, + const gchar *message, G_GNUC_UNUSED gpointer user_data) { gchar *localized_message; - gint i; + guint i; GkrellmLogFacility *f; localized_message = g_locale_from_utf8(message, -1, NULL, NULL, NULL); @@ -206,7 +206,7 @@ gkrellm_log_init() void gkrellm_log_cleanup() { - gint i; + guint i; GkrellmLogFacility *f; if (!s_log_facility_ptr_array) @@ -231,7 +231,7 @@ gkrellm_log_register( GkrellmLogCleanupFunc cleanup) { GkrellmLogFacility *f; - gint i; + guint i; if (!s_log_facility_ptr_array) return FALSE; // gkrellm_log_init() not called yet @@ -260,7 +260,7 @@ gkrellm_log_register( gboolean gkrellm_log_unregister(GkrellmLogFunc log) { - gint i; + guint i; GkrellmLogFacility *f; if (!s_log_facility_ptr_array) diff --git a/src/battery.c b/src/battery.c index bacd3cd..40d4198 100644 --- a/src/battery.c +++ b/src/battery.c @@ -382,7 +382,7 @@ estimate_battery_time_left(Battery *bat) /* charging, use exponential: eta =~ 2.5 * time-constant (~=92%) */ eta = -2.5 * dt/60 / (log(1 - (gdouble)dp/(gdouble)(p+dp))); else - eta = abs((gdouble)p / rate); /* use linear */ + eta = fabs((gdouble)p / rate); /* use linear */ #ifdef BAT_ESTIMATE_DEBUG fprintf(stderr, "eta = %.2f\t", eta); diff --git a/src/client.c b/src/client.c index e644eba..8f9d5f8 100644 --- a/src/client.c +++ b/src/client.c @@ -1787,6 +1787,11 @@ read_server_setup(gint fd) void gkrellm_client_mode_disconnect(void) { + if (client_input_id != 0) + { + gdk_input_remove(client_input_id); + client_input_id = 0; + } if (client_fd >= 0) { gkrellm_debug(DEBUG_CLIENT, "gkrellm_client_mode_disconnect(); " \ @@ -1795,8 +1800,6 @@ gkrellm_client_mode_disconnect(void) } client_fd = -1; server_alive = FALSE; - gdk_input_remove(client_input_id); - client_input_id = 0; } static void diff --git a/src/fs.c b/src/fs.c index 626bc74..5db65b1 100644 --- a/src/fs.c +++ b/src/fs.c @@ -460,7 +460,7 @@ fs_draw_decal_text(FSmon *fs, gint value) GkrellmDecal *d; GkrellmTextstyle ts_save; gchar buf[128]; - gint x_off, w; + gint x_off, w = 0; if (value == 0) { @@ -810,7 +810,7 @@ fs_update(void) if (fs->blocks > 2147483648LL) fs->krell_factor = 1024 * 1024; else if (fs->blocks > 2097152LL) - fs->krell_factor = 1024 * 1024; + fs->krell_factor = 1024; else fs->krell_factor = 1; } diff --git a/src/gkrellm-sysdeps.h b/src/gkrellm-sysdeps.h index 9a0f8fc..07295fb 100644 --- a/src/gkrellm-sysdeps.h +++ b/src/gkrellm-sysdeps.h @@ -139,7 +139,7 @@ void gkrellm_proc_assign_users(gint n_users); | the device numbers to an identifying name. It may also set an order | value for the name to control the stacking order of the disk chart. | If gkrellm_disk_assign_data_by_name() is used, then an order may be -| optionally specifed with gkrellm_sys_disk_order_from_name(). +| optionally specified with gkrellm_sys_disk_order_from_name(). | (the default order of -1 simply appends disk charts as data for them | is reported). After this function is called for a disk, the function | gkrellm_disk_subdisk_assign_data_by_name() may be called for subdisk diff --git a/src/gui.c b/src/gui.c index 406f2e9..68a43e6 100644 --- a/src/gui.c +++ b/src/gui.c @@ -1569,7 +1569,7 @@ gkrellm_save_theme_config(void) gchar *path; /* Assume gkrellm -t is for testing and don't save theme config changes. - | Similary for _GK.demo. + | Similarly for _GK.demo. */ if (!theme_modified || _GK.command_line_theme || _GK.demo || _GK.no_config) return; diff --git a/src/krell.c b/src/krell.c index 697c4a0..07a1a1d 100644 --- a/src/krell.c +++ b/src/krell.c @@ -663,7 +663,7 @@ reset_text_layer_pixmap_decal_region(GkrellmPanel *p, GkrellmDecal *d) | a decal's extents. So when scrolling, a slow Pango redraw at each scroll | step can be avoided if the text string has not changed. | There are a couple of limitations because it's impossible to generate a - | stencil bitmask of Pango rendered text (Pango doesn't allow writting to + | stencil bitmask of Pango rendered text (Pango doesn't allow writing to | depth 1 and it looks at the background pixmap colors as it renders): | 1) A scroll text decal is not transparent and will hide any objects | underneath it, so when this condition is detected, scroll drawing diff --git a/src/mail.c b/src/mail.c index a47cf01..51e53a6 100644 --- a/src/mail.c +++ b/src/mail.c @@ -814,12 +814,36 @@ tcp_shutdown(ConnInfo *conn, Mailbox *mbox, gchar *message, gboolean warn) static gboolean ssl_negotiate(ConnInfo *conn, Mailbox *mbox) { - const SSL_METHOD *ssl_method; + const SSL_METHOD *ssl_method = NULL; + gchar buf[128]; +#if defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x10100000L) + ssl_method = TLS_client_method(); + if (_GK.debug_level & DEBUG_MAIL) + { + format_remote_mbox_name(mbox, buf, sizeof(buf)); + g_debug("ssl_negotiate( %s ): will use TLS client method\n", buf); + } +#else if (mbox->account->use_ssl == SSL_TRANSPORT) + { ssl_method = SSLv23_client_method(); + if (_GK.debug_level & DEBUG_MAIL) + { + format_remote_mbox_name(mbox, buf, sizeof(buf)); + g_debug("ssl_negotiate( %s ): will use SSLv23 client method\n", buf); + } + } else + { ssl_method = TLSv1_client_method(); + if (_GK.debug_level & DEBUG_MAIL) + { + format_remote_mbox_name(mbox, buf, sizeof(buf)); + g_debug("ssl_negotiate( %s ): will use TLSv1 client method\n", buf); + } + } +#endif if (ssl_method == NULL) return tcp_shutdown(conn, mbox, N_("Cannot initialize SSL method."), @@ -1251,7 +1275,11 @@ check_imap(Mailbox *mbox) #ifdef HAVE_SSL if (account->use_ssl == SSL_STARTTLS) { - gkrellm_debug(DEBUG_MAIL, "check_imap: Issuing STARTTLS\n"); + if (_GK.debug_level & DEBUG_MAIL) + { + format_remote_mbox_name(mbox, buf, sizeof(buf)); + g_debug("check_imap( %s ): issuing STARTTLS\n", buf); + } snprintf(line, sizeof(line), "a%03d STARTTLS\r\n", ++seq); server_command(&conn, mbox, line); snprintf(line, sizeof(line), "a%03d OK", seq); @@ -1261,7 +1289,11 @@ check_imap(Mailbox *mbox) TRUE); if (!ssl_negotiate(&conn, mbox)) return FALSE; - gkrellm_debug(DEBUG_MAIL, "check_imap: STARTTLS successful\n"); + if (_GK.debug_level & DEBUG_MAIL) + { + format_remote_mbox_name(mbox, buf, sizeof(buf)); + g_debug("check_imap( %s ): STARTTLS successful\n", buf); + } } #endif @@ -1560,7 +1592,7 @@ check_maildir(Mailbox *mbox) | But, new mail arriving (writing mailbox) sets st_mtime while reading | the mailbox (mail program reading) sets st_atime. So the test | st_atime > st_mtime is testing if mbox has been read since last new mail. - | Mail readers may restore st_mtime after writting status. + | Mail readers may restore st_mtime after writing status. | And Netscape mail does status with X-Mozilla-Status: xxxS | where S is bitwise or of status flags: | 1: read 2: replied 4: marked 8: deleted diff --git a/src/mem.c b/src/mem.c index 2f85935..c130aa4 100644 --- a/src/mem.c +++ b/src/mem.c @@ -299,7 +299,7 @@ draw_decal_label(MeminfoMeter *mm, gint draw_to_screen) GkrellmDecal *d; GkrellmTextstyle ts_save; gchar buf[128]; - gint x_off, w; + gint x_off, w = 0; d = mm->decal_label; if (! mm->label_is_data) diff --git a/src/proc.c b/src/proc.c index a813066..80887b6 100644 --- a/src/proc.c +++ b/src/proc.c @@ -347,7 +347,7 @@ setup_proc_scaling(void) res = gkrellm_get_chartconfig_grid_resolution(cp->config); - /* Since grid_resolution is set for load, set krell_full_scale explicitely + /* Since grid_resolution is set for load, set krell_full_scale explicitly | to get what I want, which is 10 forks full scale. | When res or number of grids is changed, scale all fork data to keep a | fixed 50 forks/sec max on the chart. diff --git a/src/sensors.c b/src/sensors.c index 9482874..80a43e7 100644 --- a/src/sensors.c +++ b/src/sensors.c @@ -1669,7 +1669,7 @@ gkrellm_init_sensor_monitor(void) | to composite CPU on a SMP machine. | | 2.1.15 scales sensor factor/offset values by SENSOR_FLOAT_FACTOR to avoid - | writting decimal points in the config. This is not backwards compatible + | writing decimal points in the config. This is not backwards compatible | with the pre 2.1.15 sensor_config format hence the config file name | change to sensor-config. But sensor_config is forward compatible | since the float factor defaults to 1.0. diff --git a/src/sysdeps/linux.c b/src/sysdeps/linux.c index c82dfaf..921cf63 100644 --- a/src/sysdeps/linux.c +++ b/src/sysdeps/linux.c @@ -556,6 +556,8 @@ gkrellm_sys_disk_order_from_name(const gchar *name) } if (i >= table_size) i = -1; + if (i > 9) /* > hda */ + i += (i - 10) * 16 + suffix - dm->suffix_base; return i; } @@ -1523,7 +1525,7 @@ gkrellm_sys_fs_get_mounts_list(void) while (fgets(buf, sizeof(buf), f)) { dev[0] = dir[0] = type[0] = '\0'; - sscanf(buf, "%512s %512s %127s", dev, dir, type); + sscanf(buf, "%511s %511s %127s", dev, dir, type); fix_fstab_name(dev); fix_fstab_name(dir); fix_fstab_name(type); @@ -3155,6 +3157,7 @@ sensors_nvidia_smi_read(gboolean setup) || !strcmp(id, ":") ) continue; + stmp = str; if ((str = g_strstr_len(str, -1, "Temperature")) != NULL) { str += 11; @@ -3183,6 +3186,10 @@ sensors_nvidia_smi_read(gboolean setup) else if ((smi = nvidia_smi_lookup(id)) != NULL) smi->temp = temp; } + else + { + str = stmp; + } } } if (output) @@ -4029,7 +4036,7 @@ gkrellm_sys_sensors_init(void) sensors_nvidia_smi_read(TRUE); - /* nvidia-settings GPU core & ambient temperatues + /* nvidia-settings GPU core & ambient temperatures */ cnt = sensors_nvidia_settings_ngpus(); ngpus_added = 0; diff --git a/src/utils.c b/src/utils.c index f6162e9..0190ed8 100644 --- a/src/utils.c +++ b/src/utils.c @@ -276,13 +276,17 @@ gkrellm_format_size_abbrev(gchar *buf, size_t buflen, gfloat size, { gfloat abs_size; gint i; + int ret; abs_size = (size < 0.0) ? -size : size; for (i = 0; i < tbl_size - 1; ++i) if (abs_size < tbl[i].limit) break; - return snprintf(buf, buflen, tbl[i].format, size / tbl[i].divisor); + ret = snprintf(buf, buflen, tbl[i].format, size / tbl[i].divisor); + if (ret < 0 || ret >= buflen) + return 0; + return ret; } @@ -366,7 +370,8 @@ gkrellm_text_extents(PangoFontDescription *font_desc, gchar *text, else { utf8 = g_locale_to_utf8(text, -1, NULL, NULL, NULL); - pango_layout_set_text(layout, utf8, len); + if (utf8) + pango_layout_set_text(layout, utf8, len); g_free(utf8); } iter = pango_layout_get_iter(layout); @@ -456,7 +461,8 @@ gkrellm_gdk_draw_text(GdkDrawable *drawable, PangoFontDescription *font_desc, layout = gtk_widget_create_pango_layout(gkrellm_get_top_window(), NULL); pango_layout_set_font_description(layout, font_desc); - pango_layout_set_text(layout, string, len); + if (g_utf8_validate(string, -1, NULL)) + pango_layout_set_text(layout, string, len); gdk_draw_layout(drawable, gc, x, y, layout); g_object_unref(layout); }