[BusyBox] make_directory

Glenn McGrath bug1 at optushome.com.au
Thu Aug 1 08:22:04 UTC 2002


I think the libbb make_directory function could be simpler, maybe
something like.

void make_recursive_directory(char *path, mode_t mode)
{
        const char *path_ptr = strrchr(path, '/');
        if (path_ptr) {
                const char removed_char = *path_ptr;
                *path_ptr = '\0';
                if ((mkdir(path, mode) == -1) && (errno == ENOENT)) {
                        make_recursive_directory(path, mode);
                        mkdir(path, mode);
                }
                *path_ptr = removed_char;
        }
}

I havent tried to integrate it yet, i will look into it further.


Glenn



More information about the busybox mailing list