Esempio n. 1
0
static int
my_mkdir_rec (char *s, mode_t mode)
{
    char *p, *q;
    int result;

    if (!mc_mkdir (s, mode))
	return 0;
    else if (errno != ENOENT)
	return -1;

    /* FIXME: should check instead if s is at the root of that filesystem */
    if (!vfs_file_is_local (s))
	return -1;

    if (!strcmp (s, PATH_SEP_STR)) {
	errno = ENOTDIR;
	return -1;
    }

    p = concat_dir_and_file (s, "..");
    q = vfs_canon (p);
    g_free (p);

    if (!(result = my_mkdir_rec (q, mode)))
	result = mc_mkdir (s, mode);

    g_free (q);
    return result;
}
Esempio n. 2
0
int
my_mkdir (const char *s, mode_t mode)
{
    int result;
    char *my_s;

    result = mc_mkdir (s, mode);
    if (result)
    {
        char *p = vfs_canon (s);

        result = my_mkdir_rec (p, mode);
        g_free (p);
    }
    if (result == 0)
    {
        my_s = get_absolute_name (s);

#ifdef FIXME
        tree_add_entry (tree, my_s);
#endif

        g_free (my_s);
    }
    return result;
}