Skip to content

Commit 19280c5

Browse files
authored
Document current default permissions for tempdirs (#296)
Fixes implying that the default is the same as the one for tempfiles
1 parent c5eac9f commit 19280c5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,6 @@ impl<'a, 'b> Builder<'a, 'b> {
337337
}
338338

339339
/// The permissions to create the tempfile or [tempdir](Self::tempdir) with.
340-
/// This allows to them differ from the default mode of `0o600` on Unix.
341340
///
342341
/// # Security
343342
///
@@ -350,9 +349,13 @@ impl<'a, 'b> Builder<'a, 'b> {
350349
/// # Platform Notes
351350
/// ## Unix
352351
///
353-
/// The actual permission bits set on the tempfile or tempdir will be affected by the
354-
/// `umask` applied by the underlying syscall.
352+
/// The actual permission bits set on the tempfile or tempdir will be affected by the `umask`
353+
/// applied by the underlying syscall. The actual permission bits are calculated via
354+
/// `permissions & !umask`.
355355
///
356+
/// Permissions default to `0o600` for tempfiles and `0o777` for tempdirs. Note, this doesn't
357+
/// include effects of the current `umask`. For example, combined with the standard umask
358+
/// `0o022`, the defaults yield `0o600` for tempfiles and `0o755` for tempdirs.
356359
///
357360
/// ## Windows and others
358361
///

0 commit comments

Comments
 (0)