~ chicken-core (chicken-5) 06df89dc0e28a83f25338202f0da1ddfad183199
commit 06df89dc0e28a83f25338202f0da1ddfad183199 Author: LemonBoy <thatlemon@gmail.com> AuthorDate: Mon Feb 29 11:56:05 2016 +1300 Commit: Peter Bex <peter@more-magic.net> CommitDate: Mon Feb 29 22:35:07 2016 +0100 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 <evhan@foldling.org> Signed-off-by: Peter Bex <peter@more-magic.net> diff --git a/posixunix.scm b/posixunix.scm index 2e9b9cdf..f56960dd 100644 --- a/posixunix.scm +++ b/posixunix.scm @@ -1351,7 +1351,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-number start loc) (if (eq? #t len) (set! len 0)Trap