summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'x11-plugins/wmmemfree/files/wmmemfree-0.7-fix-crash-when-there-is-no-swap.patch')
-rw-r--r--x11-plugins/wmmemfree/files/wmmemfree-0.7-fix-crash-when-there-is-no-swap.patch18
1 files changed, 18 insertions, 0 deletions
diff --git a/x11-plugins/wmmemfree/files/wmmemfree-0.7-fix-crash-when-there-is-no-swap.patch b/x11-plugins/wmmemfree/files/wmmemfree-0.7-fix-crash-when-there-is-no-swap.patch
new file mode 100644
index 000000000000..d062fd9ee09b
--- /dev/null
+++ b/x11-plugins/wmmemfree/files/wmmemfree-0.7-fix-crash-when-there-is-no-swap.patch
@@ -0,0 +1,18 @@
+--- wmmemfree-0.7/draw.c 2003-03-21 21:56:25.000000000 +0100
++++ wmmemfree-0.7/draw.c 2008-02-16 10:02:51.000000000 +0100
+@@ -44,13 +44,13 @@
+ XCopyArea(display, on, buffer, gc, 0, 0, 2, 11, 7 + n * 2, 27);
+ else
+ XCopyArea(display, off, buffer, gc, 0, 0, 2, 11, 7 + n * 2, 27);
+- if(n < (swp * 25 / swp_total))
++ if(n < ((swp_total) ? (swp * 25 / swp_total) : 0))
+ XCopyArea(display, on, buffer, gc, 0, 0, 2, 11, 7 + n * 2, 47);
+ else
+ XCopyArea(display, off, buffer, gc, 0, 0, 2, 11, 7 + n * 2, 47);
+ }
+ mem_percent = mem * 100 / mem_total;
+- swp_percent = swp * 100 / swp_total;
++ swp_percent = (swp_total) ? swp * 100 / swp_total : 0;
+ if(mem_percent == 100)
+ XCopyArea(display, numbers, buffer, gc, 5, 0, 5, 6, 33, 20);
+ else