Fix mkpath() ignoring mode when umask is more restrictive

mkpath(dir, 0755) with umask 0027 silently creates a 0750 directory,
since mkdir(2) applies the umask to the requested mode.  Callers pass
an explicit mode and expect exactly that.

Apply the mode with chmod() after each successful mkdir().

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-09-13 17:17:37 +02:00
1 parent c1e050f93c
commit e874608b76
3 files changed
+49 -3

No files matched your search

+8
View File
@@ -4,6 +4,14 @@ Change Log
All notable changes to the project are documented in this file.
[UNRELEASED][]
--------------
### Fixes
- Fix `mkpath()`, and `fmkpath()`, not applying the given mode when the
process umask is more restrictive, e.g., requesting 0755 with umask
0027 silently created a 0750 directory
[v2.6.2][] - 2025-11-22
-----------------------