Commit Graph
3 Commits
Author SHA1 Message Date
omrzk eb883301b3 Do not let mkpath() accept an existing non-directory
mkpath(), fmkpath(), and makepath() return success when the path exists
as a regular file, or anything else that is not a directory:

    touch /tmp/foo; mkpath("/tmp/foo", 0755);

Any path that stat() can find is taken to be done.

Check that it is a directory, otherwise fail with ENOTDIR.

Closes #26
2026-11-16 14:13:07 +01:00
Joachim Wiberg e874608b76 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>
2026-09-13 17:17:37 +02:00
Joachim Wiberg c9633ffbb0 Rename tests/ -> test/ and update internal refs.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-10-03 12:22:33 +02:00