1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 03:30:27 +02:00

Fix bug in nftw function

Fixes bug #44182. Thanks to Matija Obid for the report and RhodiumToad in
This commit is contained in:
Daniel Llorens 2021-05-21 14:19:49 +02:00
parent d1c6ae19f4
commit f499754bc8

View file

@ -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)