[arch-commits] Commit in devicekit-power/trunk (2 files)

Jan de Groot jgc at archlinux.org
Sat Dec 19 20:26:56 UTC 2009


    Date: Saturday, December 19, 2009 @ 15:26:56
  Author: jgc
Revision: 61579

Add missing patches

Added:
  devicekit-power/trunk/check-swap.patch
  devicekit-power/trunk/fix-segfault-history.patch

----------------------------+
 check-swap.patch           |   43 +++++++++++++++++++++++++++++++++++++++++++
 fix-segfault-history.patch |   25 +++++++++++++++++++++++++
 2 files changed, 68 insertions(+)

Added: check-swap.patch
===================================================================
--- check-swap.patch	                        (rev 0)
+++ check-swap.patch	2009-12-19 20:26:56 UTC (rev 61579)
@@ -0,0 +1,43 @@
+From bbb102c394eff71d84801b48b11e022b1fecb497 Mon Sep 17 00:00:00 2001
+From: Debbie Beliveau <debbie.beliveau at gmail.com>
+Date: Wed, 16 Dec 2009 16:29:29 +0000
+Subject: Check if swap exists before determining how much is free
+
+Signed-off-by: Richard Hughes <richard at hughsie.com>
+---
+diff --git a/src/dkp-daemon.c b/src/dkp-daemon.c
+index eb16a63..47d84d5 100644
+--- a/src/dkp-daemon.c
++++ b/src/dkp-daemon.c
+@@ -250,6 +250,7 @@ dkp_daemon_check_swap_space (DkpDaemon *daemon)
+ 	gboolean ret;
+ 	guint active = 0;
+ 	guint swap_free = 0;
++	guint swap_total = 0;
+ 	guint len;
+ 	guint i;
+ 	gfloat percentage = 0.0f;
+@@ -271,12 +272,21 @@ dkp_daemon_check_swap_space (DkpDaemon *daemon)
+ 		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 not consider all swap space used */
++	if (swap_total == 0) {
++		egg_debug ("no swap space found");
++		percentage = 100.0f;
++		goto out;
++	}
++
+ 	/* work out how close to the line we are */
+ 	if (swap_free > 0 && active > 0)
+ 		percentage = (active * 100) / swap_free;
+--
+cgit v0.8.3-6-g21f6

Added: fix-segfault-history.patch
===================================================================
--- fix-segfault-history.patch	                        (rev 0)
+++ fix-segfault-history.patch	2009-12-19 20:26:56 UTC (rev 61579)
@@ -0,0 +1,25 @@
+From 0348f788d9dc1ac35ff07d2a15acc9da109ca60c Mon Sep 17 00:00:00 2001
+From: Richard Hughes <richard at hughsie.com>
+Date: Mon, 14 Dec 2009 12:35:14 +0000
+Subject: Fix segfault in the history code. Fixes fd#25632
+
+---
+diff --git a/src/dkp-history.c b/src/dkp-history.c
+index 23bf4c2..b851642 100644
+--- a/src/dkp-history.c
++++ b/src/dkp-history.c
+@@ -295,6 +295,12 @@ dkp_history_get_profile_data (DkpHistory *history, gboolean charging)
+ 
+ 		/* round to the nearest int */
+ 		bin = rint (obj->value);
++
++		/* ensure bin is in range */
++		if (bin >= data->len)
++			bin = data->len - 1;
++
++		/* different */
+ 		if (oldbin != bin) {
+ 			oldbin = bin;
+ 			if (obj_old != NULL) {
+--
+cgit v0.8.3-6-g21f6




More information about the arch-commits mailing list