(File System): In mkstemp!, in fact posix doesn't specify
authorKevin Ryde <user42@zip.com.au>
Fri, 4 Feb 2005 22:40:21 +0000 (22:40 +0000)
committerKevin Ryde <user42@zip.com.au>
Fri, 4 Feb 2005 22:40:21 +0000 (22:40 +0000)
the permissions mode.  Add an example setting 666 less umask.

doc/ref/posix.texi

index 8007232..93dd3cc 100644 (file)
@@ -894,8 +894,16 @@ buffered port open for reading and writing to the file.
 created: it must end with @samp{XXXXXX} and will be changed in
 place to return the name of the temporary file.
 
-The file is created with mode @code{0600}, which means read and write
-for the owner only.  @code{chmod} can be used to change this.
+POSIX doesn't specify the permissions mode of the file, on a GNU
+system it's @code{#o600} (but was @code{#o666} in the past).  An
+application can use @code{chmod} to set what it wants.  For example
+@code{#o666} less @code{umask} is usual for ordinary files,
+
+@example
+(let ((port (mkstemp! (string-copy "file-XXXXXX"))))
+  (chmod port (logand #o666 (lognot (umask))))
+  ...)
+@end example
 @end deffn
 
 @deffn {Scheme Procedure} dirname filename