From 0fc0b54f59f25c4dea1dc05e8bd7922f91607680 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 12 Oct 2022 17:37:58 +0300 Subject: [PATCH 36/36] make_dir(): Don't consider root directory as directory separator When given an absolute path, make_dir() tried to create whats-left-side-of-root, i.e., nothing, as the first component. See osdn #45830 Signed-off-by: Marko Lindqvist --- utility/shared.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utility/shared.c b/utility/shared.c index ea968a0335..4fbe79a8d5 100644 --- a/utility/shared.c +++ b/utility/shared.c @@ -1743,6 +1743,12 @@ bool make_dir(const char *pathname) path = interpret_tilde_alloc(pathname); dir = path; + + if (*dir == '/') { + /* Don't consider root as directory separator, but skip it. */ + dir++; + } + do { dir = strchr(dir, DIR_SEPARATOR_CHAR); /* We set the current / with 0, and restore it afterwards */ -- 2.35.1