summaryrefslogtreecommitdiff
path: root/module
diff options
context:
space:
mode:
authorDaniel Llorens <lloda@sarc.name>2021-05-21 14:19:49 +0200
committerDaniel Llorens <lloda@sarc.name>2021-05-21 14:19:49 +0200
commitf499754bc8291a044c5034b634ac02a01bde9b49 (patch)
tree36225ed1bb4165f0e3a31ab5ab1ce7b6ab3df140 /module
parentd1c6ae19f4e6ab8b3b607a5b14f65c437c06e065 (diff)
downloadguile-f499754bc8291a044c5034b634ac02a01bde9b49.tar.gz
Fix bug in nftw function
Fixes bug #44182. Thanks to Matija Obid for the report and RhodiumToad in
Diffstat (limited to 'module')
-rw-r--r--module/ice-9/ftw.scm8
1 files changed, 4 insertions, 4 deletions
diff --git a/module/ice-9/ftw.scm b/module/ice-9/ftw.scm
index dd6f49089..ac6aa6316 100644
--- a/module/ice-9/ftw.scm
+++ b/module/ice-9/ftw.scm
@@ -307,10 +307,10 @@
(else (values s (easy-flag s))))))))
(define (clean name)
- (let ((last-char-index (1- (string-length name))))
- (if (char=? #\/ (string-ref name last-char-index))
- (substring name 0 last-char-index)
- name)))
+ (let ((end (- (string-length name) 1)))
+ (if (and (positive? end) (char=? #\/ (string-ref name end)))
+ (substring name 0 end)
+ name)))
(define (ftw filename proc . options)
(let* ((visited? (visited?-proc (cond ((memq 'hash-size options) => cadr)