From e10d08df7edbb2e9e90169d19c3361099802fad6 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 7 May 2019 17:48:32 +0300 Subject: [PATCH] Fix 'load-average' on MS-Windows * src/w32.c (getloadavg): Always return at least one element of the array. --- src/w32.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/w32.c b/src/w32.c index 677c37fcb5d..833ff4c7e4a 100644 --- a/src/w32.c +++ b/src/w32.c @@ -2003,6 +2003,13 @@ getloadavg (double loadavg[], int nelem) loadavg[elem] = avg; } + /* Always return at least one element, otherwise load-average + returns nil, and Lisp programs might decide we cannot measure + system load. For example, jit-lock-stealth-load's defcustom + might decide that feature is "unsupported". */ + if (elem == 0) + loadavg[elem++] = 0.09; /* < display-time-load-average-threshold */ + return elem; } -- 2.39.2