~ chicken-core (chicken-5) 06a55aa38afd91993b2f4d4ee55eec82f110ffc4
commit 06a55aa38afd91993b2f4d4ee55eec82f110ffc4 Author: Mario Domenech Goulart <mario.goulart@gmail.com> AuthorDate: Fri Aug 5 23:15:23 2016 +0200 Commit: Evan Hanson <evhan@foldling.org> CommitDate: Thu Aug 11 22:10:45 2016 +1200 create-temporary-directory: don't try to mkdir if a file with the same name exists By checking for the existence of a _directory_ in create-temporary-directory, the following program would eventually cause a runtime error, as a _file_ with the same name would exist: (use files) (let loop () (create-temporary-file "") (create-temporary-directory) (loop)) Error: (create-temporary-directory) cannot create temporary directory - File exists: ... Use file-exists? instead of directory-exists? to work around this issue. Signed-off-by: Evan Hanson <evhan@foldling.org> diff --git a/files.scm b/files.scm index e06cf202..43f92f91 100644 --- a/files.scm +++ b/files.scm @@ -343,7 +343,7 @@ EOF (number->string n 16) "." (##sys#number->string (##sys#fudge 33)))))) ; PID - (if (directory-exists? pn) + (if (file-exists? pn) (loop) (let ((r (##core#inline "C_mkdir" (##sys#make-c-string pn 'create-temporary-directory)))) (if (eq? r 0)Trap