utils: add fastpath routine on mkdir_p function

Call 'access' to examine whether 'dir' is already existed or not instead
of directly calling 'mkdir' on each dir name separated by slash '/' even though
'dir' is existed.

Signed-off-by: Leesoo Ahn <lsahn@ooseel.net>
This commit is contained in:
Leesoo Ahn 2022-03-26 21:09:05 +09:00
parent 90a9b72667
commit 0a0911faee

View File

@ -218,6 +218,9 @@ int mkdir_p(const char *dir, mode_t mode)
const char *tmp = dir; const char *tmp = dir;
const char *orig = dir; const char *orig = dir;
if (access(dir, F_OK) != -1)
return 0;
do { do {
__do_free char *makeme = NULL; __do_free char *makeme = NULL;
int ret; int ret;