From 80471d9440c02f04e1d8518be775b148b65dbfc8 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Fri, 16 Aug 2013 15:50:38 -0500 Subject: [PATCH] * usr/lib/byobu/network: LP: #1203601 - fix issue where /proc/net/dev isn't read correctly; use an intermediate cache file --- debian/changelog | 3 +++ usr/lib/byobu/network | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 7a35f9b9..388b4acb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,9 @@ byobu (5.56) unreleased; urgency=low * usr/lib/byobu/battery: - fix battery status caching issues when battery is full, or plugged into AC + * usr/lib/byobu/network: LP: #1203601 + - fix issue where /proc/net/dev isn't read correctly; use an + intermediate cache file -- Dustin Kirkland Sat, 10 Aug 2013 09:23:04 +0100 diff --git a/usr/lib/byobu/network b/usr/lib/byobu/network index 43ac2ff0..94038f8d 100755 --- a/usr/lib/byobu/network +++ b/usr/lib/byobu/network @@ -41,6 +41,7 @@ __network() { cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/network.$i" [ -r "$cache" ] && read x1 < "$cache" || tx1=0 local iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed + cat /proc/net/dev > "$cache".dev while read iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed; do case "$iface" in ${interface}:) @@ -53,7 +54,7 @@ __network() { break; ;; esac - done < /proc/net/dev + done < "$cache".dev printf "%s" "$x2" > "$cache" rate=$((8*($x2 - $x1) / $t / 1024)) # in kbps [ "$rate" -lt 0 ] && rate=0