mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-27 11:13:50 +00:00
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:
parent
90a9b72667
commit
0a0911faee
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user