1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-15 09:47:20 +00:00

Fix 'load-average' on MS-Windows

* src/w32.c (getloadavg): Always return at least one element
of the array.
This commit is contained in:
Eli Zaretskii 2019-05-07 17:48:32 +03:00
parent 921d279e15
commit e10d08df7e

View File

@ -2003,6 +2003,13 @@ getloadavg (double loadavg[], int nelem)
loadavg[elem] = avg; 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; return elem;
} }