Index: devicekit-power-011/src/dkp-daemon.c =================================================================== --- devicekit-power-011.orig/src/dkp-daemon.c 2009-12-15 13:47:52.000000000 -0500 +++ devicekit-power-011/src/dkp-daemon.c 2009-12-15 13:48:57.000000000 -0500 @@ -139,6 +139,7 @@ gboolean ret; guint active = 0; guint swap_free = 0; + guint swap_total = 0; guint len; guint i; gfloat percentage = 0.0f; @@ -160,14 +161,19 @@ if (len > 3) { if (g_strcmp0 (tokens[0], "SwapFree") == 0) swap_free = atoi (tokens[len-2]); + if (g_strcmp0 (tokens[0], "SwapTotal") == 0) + swap_total = atoi (tokens[len-2]); else if (g_strcmp0 (tokens[0], "Active") == 0) active = atoi (tokens[len-2]); } g_strfreev (tokens); } + /* first check if we even have swap */ + if (swap_total == 0) + percentage = 100.0f; /* consider all swap space used */ /* work out how close to the line we are */ - if (swap_free > 0 && active > 0) + else if (swap_free > 0 && active > 0) percentage = (active * 100) / swap_free; egg_debug ("total swap available %i kb, active memory %i kb (%.1f%%)", swap_free, active, percentage); out: