>From 1dbcc0db6520e2f7aa6454fac808256ce38249b1 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Sun, 28 Feb 2016 20:34:56 +0100 Subject: [PATCH] Check if port is open before file-lock operations The file-lock functions in posixunix.scm didn't check if the port was actually open. Calling fileno on a closed descriptor causes a invalid memory read, as pointed out by valgrind. Signed-off-by: Evan Hanson --- posixunix.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/posixunix.scm b/posixunix.scm index 7ad7e3d..899ead6 100644 --- a/posixunix.scm +++ b/posixunix.scm @@ -1414,7 +1414,7 @@ EOF (define (setup port args loc) (let-optionals* args ([start 0] [len #t] ) - (##sys#check-port port loc) + (##sys#check-open-port port loc) (##sys#check-exact-integer start loc) (if (eq? #t len) (set! len 0) -- 2.7.0.rc3