~ chicken-core (chicken-5) 26915785e4043b08ed811800eb9a500b7bfbba09


commit 26915785e4043b08ed811800eb9a500b7bfbba09
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Fri Dec 17 07:50:58 2010 -0500
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Fri Dec 17 07:50:58 2010 -0500

    allow optional mask arg for file-creation-mode to allow use of parameterize

diff --git a/manual/Unit posix b/manual/Unit posix
index a9c586dc..cf46f22c 100644
--- a/manual/Unit posix	
+++ b/manual/Unit posix	
@@ -538,6 +538,10 @@ Returns the initial file permissions used for newly created files
 
   (set! (file-creation-mode) MODE)
 
+or
+
+  (file-creation-mode MODE)
+
 where {{MODE}} is a bitwise combination of one or more of
 the {{perm/...}} flags.
 
diff --git a/posix-common.scm b/posix-common.scm
index 4b755a43..aec36d62 100644
--- a/posix-common.scm
+++ b/posix-common.scm
@@ -367,10 +367,12 @@ EOF
 
 (define file-creation-mode
   (getter-with-setter
-   (lambda ()
-     (let ((um (##core#inline "C_umask" 0)))
-       (##core#inline "C_umask" um)
-       um))
+   (lambda (#!optional um)
+     (when um (##sys#check-exact um 'file-creation-mode))
+     (let ((um2 (##core#inline "C_umask" um)))
+       (unless um (##core#inline "C_umask" um2)
+       um2)))
    (lambda (um)
+     (##sys#check-exact um 'file-creation-mode)
      (##core#inline "C_umask" um))
    "(file-creation-mode mode)"))
Trap