[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Ludovic Courtès |
Date: |
Thu, 1 Mar 2018 11:31:44 -0500 (EST) |
branch: master
commit a861d7d5bd997d0776f840847186fc198e87e1d9
Author: Ludovic Courtès <address@hidden>
Date: Thu Feb 15 22:55:51 2018 +0100
logging: "Defensive programming" for 'log-monitoring-stats'.
I've seen 'scandir' report #f once, even though that's theoretically
impossible.
* src/cuirass/logging.scm (log-monitoring-stats): Return '() if
'scandir' returns #f.
---
src/cuirass/logging.scm | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/cuirass/logging.scm b/src/cuirass/logging.scm
index 12d156c..6258eed 100644
--- a/src/cuirass/logging.scm
+++ b/src/cuirass/logging.scm
@@ -71,6 +71,9 @@
(/ (assoc-ref (gc-stats) 'heap-size) (expt 2. 20))
(length (all-threads))
(length
- (scandir "/proc/self/fd"
- (lambda (file)
- (not (member file '("." ".."))))))))
+ ;; In theory 'scandir' cannot return #f, but in practice,
+ ;; we've seen it before.
+ (or (scandir "/proc/self/fd"
+ (lambda (file)
+ (not (member file '("." "..")))))
+ '()))))
- master updated (f5a15ca -> aa4c778), Ludovic Courtès, 2018/03/01
- [no subject], Ludovic Courtès, 2018/03/01
- [no subject],
Ludovic Courtès <=
- [no subject], Ludovic Courtès, 2018/03/01
- [no subject], Ludovic Courtès, 2018/03/01
- [no subject], Ludovic Courtès, 2018/03/01
- [no subject], Ludovic Courtès, 2018/03/01
- [no subject], Ludovic Courtès, 2018/03/01
- [no subject], Ludovic Courtès, 2018/03/01