[gnutls-devel] [PATCH 1/3] guile: Guile 2.x 'uniform-vector-read!' replacement returns 0 upon EOF.

Ludovic Courtès ludo at gnu.org
Wed Oct 5 14:30:31 CEST 2016


This problem was never hit in practice because our tests always got the
non-EOF case.

* guile/modules/gnutls/build/tests.scm (uniform-vector-read!) [guile-2]:
Return 0 upon EOF.
---
 guile/modules/gnutls/build/tests.scm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/guile/modules/gnutls/build/tests.scm b/guile/modules/gnutls/build/tests.scm
index 2fe6be2..2c5c573 100644
--- a/guile/modules/gnutls/build/tests.scm
+++ b/guile/modules/gnutls/build/tests.scm
@@ -70,7 +70,8 @@ process exits upon failure."
 
   (else                                           ;2.0 and 2.2
    (use-modules (rnrs io ports)
-                (rnrs bytevectors))
+                (rnrs bytevectors)
+                (ice-9 match))
 
    (define-syntax-rule (define-replacement (name args ...) body ...)
      ;; Define a compatibility replacement for NAME, if needed.
@@ -84,8 +85,10 @@ process exits upon failure."
    ;; and absent in 2.2.
 
    (define-replacement (uniform-vector-read! buf port)
-     (get-bytevector-n! port buf
-                        0 (bytevector-length buf)))
+     (match (get-bytevector-n! port buf
+                               0 (bytevector-length buf))
+       ((? eof-object?) 0)
+       ((? integer? n)  n)))
 
    (define-replacement (uniform-vector-write buf port)
      (put-bytevector port buf))))
-- 
2.10.0




More information about the Gnutls-devel mailing list