mkdir: allow to create directory whose path contains symlink
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 2 Feb 2022 05:20:48 +0000 (14:20 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 2 Feb 2022 06:09:45 +0000 (15:09 +0900)
commit5117059ee9f84ed2fd37801ec0b90473db475422
tree7b4c42fefa2753fcad4cbab1f6400a6271d05e1c
parente22916e61d1fdb7b46918b605ebf783d9017f9d8
mkdir: allow to create directory whose path contains symlink

Fixes a regression caused by 3008a6f21c1c42efe852d69798a2fdd63fe657ec.

Before the commit, when `mkdir_parents_internal()` is called from `mkdir_p()`,
it uses `_mkdir()` as `flag` is zero. But after the commit, `mkdir_safe_internal()`
is always used. Hence, if the path contains a symlink, it fails with -ENOTDIR.

To fix the issue, this makes `mkdir_p()` calls `mkdir_parents_internal()` with
MKDIR_FOLLOW_SYMLINK flag.

Fixes #22334.
src/basic/mkdir.c