aboutsummaryrefslogtreecommitdiffstats
path: root/lib/os_mon
diff options
context:
space:
mode:
authorViacheslav V. Kovalev <[email protected]>2015-01-10 14:31:28 +0300
committerBjörn-Egil Dahlberg <[email protected]>2015-03-18 15:35:15 +0100
commite36017157ee5d8d7f50a769a2ecfce4ece1eea64 (patch)
tree732cc9862a83819ceb7d9d085b15202cea50a723 /lib/os_mon
parent5f5aa9ef75e21d7351d489bc8e28697cbb23219a (diff)
downloadotp-e36017157ee5d8d7f50a769a2ecfce4ece1eea64.tar.gz
otp-e36017157ee5d8d7f50a769a2ecfce4ece1eea64.tar.bz2
otp-e36017157ee5d8d7f50a769a2ecfce4ece1eea64.zip
Handle big loadavg values correctly
Do not crash with badmatch when integer part of loadavg has more than 2 digits.
Diffstat (limited to 'lib/os_mon')
-rw-r--r--lib/os_mon/src/cpu_sup.erl2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/os_mon/src/cpu_sup.erl b/lib/os_mon/src/cpu_sup.erl
index 1f088ecbde..66e7973e7e 100644
--- a/lib/os_mon/src/cpu_sup.erl
+++ b/lib/os_mon/src/cpu_sup.erl
@@ -221,7 +221,7 @@ get_uint32_measurement(Request, #internal{port = P, os_type = {unix, sunos}}) ->
port_server_call(P, Request);
get_uint32_measurement(Request, #internal{os_type = {unix, linux}}) ->
{ok,F} = file:open("/proc/loadavg",[read,raw]),
- {ok,D} = file:read(F,24),
+ {ok,D} = file:read_line(F),
ok = file:close(F),
{ok,[Load1,Load5,Load15,_PRun,PTotal],_} = io_lib:fread("~f ~f ~f ~d/~d", D),
case Request of