guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] branch main updated: Fix bug in nftw function


From: Daniel Llorens
Subject: [Guile-commits] branch main updated: Fix bug in nftw function
Date: Fri, 21 May 2021 08:22:22 -0400

This is an automated email from the git hooks/post-receive script.

lloda pushed a commit to branch main
in repository guile.

The following commit(s) were added to refs/heads/main by this push:
     new f499754  Fix bug in nftw function
f499754 is described below

commit f499754bc8291a044c5034b634ac02a01bde9b49
Author: Daniel Llorens <lloda@sarc.name>
AuthorDate: Fri May 21 14:19:49 2021 +0200

    Fix bug in nftw function
    
    Fixes bug #44182. Thanks to Matija Obid for the report and RhodiumToad in
---
 module/ice-9/ftw.scm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/module/ice-9/ftw.scm b/module/ice-9/ftw.scm
index dd6f490..ac6aa63 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]