<xfce4-taskmanager:master> Fix SIGBUS on Debian x86_64 (original patch from Jérôme Guelfucci)
Mike Massonnet
noreply at xfce.org
Sun Jun 13 19:34:01 CEST 2010
Updating branch refs/heads/master
to 9d8b776288b5e4e026c5753c183de072cd476402 (commit)
from d40bd9362a709c26abb3c17b9e4d151eacb5e3fa (commit)
commit 9d8b776288b5e4e026c5753c183de072cd476402
Author: Mike Massonnet <mmassonnet at xfce.org>
Date: Sun Jun 13 19:19:41 2010 +0200
Fix SIGBUS on Debian x86_64 (original patch from Jérôme Guelfucci)
Something strange happened when doing a comparison between a guint type
and sizeof(), turning it back to gint fixes the issue. Fix other
compiler warnings at the same time.
src/Makefile.am | 2 +-
src/task-manager-linux.c | 20 ++++++++++----------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index b9fdf3f..f8a1fc3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,7 @@
NULL =
INCLUDES = \
- -I$(top_srcdir)/include \
+ -I$(top_srcdir) \
-DG_LOG_DOMAIN=\"xfce4-taskmanager\" \
-DPACKAGE_LOCALE_DIR=\"$(localedir)\"
diff --git a/src/task-manager-linux.c b/src/task-manager-linux.c
index 8aaaeea..dbbecaa 100644
--- a/src/task-manager-linux.c
+++ b/src/task-manager-linux.c
@@ -42,12 +42,12 @@ get_memory_usage (guint64 *memory_total, guint64 *memory_free, guint64 *memory_c
while (found < 6 && fgets (buffer, 1024, file) != NULL)
{
- found += sscanf (buffer, "MemTotal:\t%llu kB", memory_total);
- found += sscanf (buffer, "MemFree:\t%llu kB", memory_free);
- found += sscanf (buffer, "Cached:\t%llu kB", memory_cache);
- found += sscanf (buffer, "Buffers:\t%llu kB", memory_buffers);
- found += sscanf (buffer, "SwapTotal:\t%llu kB", swap_total);
- found += sscanf (buffer, "SwapFree:\t%llu kB", swap_free);
+ found += sscanf (buffer, "MemTotal:\t%llu kB", (unsigned long long*)memory_total);
+ found += sscanf (buffer, "MemFree:\t%llu kB", (unsigned long long*)memory_free);
+ found += sscanf (buffer, "Cached:\t%llu kB", (unsigned long long*)memory_cache);
+ found += sscanf (buffer, "Buffers:\t%llu kB", (unsigned long long*)memory_buffers);
+ found += sscanf (buffer, "SwapTotal:\t%llu kB", (unsigned long long*)swap_total);
+ found += sscanf (buffer, "SwapFree:\t%llu kB", (unsigned long long*)swap_free);
}
fclose (file);
@@ -127,7 +127,7 @@ get_task_cmdline (Task *task)
{
FILE *file;
gchar filename[96];
- guint i;
+ gint i;
gchar c;
snprintf (filename, 96, "/proc/%i/cmdline", task->pid);
@@ -135,7 +135,7 @@ get_task_cmdline (Task *task)
return FALSE;
/* Read full command byte per byte until EOF */
- for (i = 0; (c = fgetc (file)) != EOF && i < sizeof (task->cmdline) - 1; i++)
+ for (i = 0; (c = fgetc (file)) != EOF && i < (gint)sizeof (task->cmdline) - 1; i++)
task->cmdline[i] = (c == '\0') ? ' ' : c;
task->cmdline[i] = '\0';
if (task->cmdline[i-1] == ' ')
@@ -253,8 +253,8 @@ get_task_details (guint pid, Task *task)
&idummy, // itrealvalue time in jiffies to next SIGALRM send to this process
&idummy, // starttime jiffies the process startet after system boot
- &task->vsz, // vsize in bytes
- &task->rss, // rss (number of pages in real memory)
+ (unsigned long long*)&task->vsz, // vsize in bytes
+ (unsigned long long*)&task->rss, // rss (number of pages in real memory)
dummy, // rlim limit in bytes for rss
dummy, // startcode
More information about the Xfce4-commits
mailing list