Xinqi Bao's Git
projects
/
slstatus.git
/ diff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
| inline |
side by side
(parent:
8068157
)
swap_perc: check for division by zero on obsd too
author
Aaron Marcher <
[email protected]
>
Sun, 20 May 2018 22:02:33 +0000
(
00:02
+0200)
committer
Aaron Marcher <
[email protected]
>
Sun, 20 May 2018 22:02:33 +0000
(
00:02
+0200)
components/swap.c
diff
|
blob
|
history
diff --git
a/components/swap.c
b/components/swap.c
index
465ffd4
..
f5db667
100644
(file)
--- a/
components/swap.c
+++ b/
components/swap.c
@@
-188,6
+188,10
@@
getstats(&total, &used);
+ if (total == 0) {
+ return NULL;
+ }
+
return bprintf("%d%%", 100 * used / total);
}