mufs: optionally record the type and file_size in resolve_path()
This commit is contained in:
parent
d9e11a083b
commit
26b0ccb405
5 changed files with 31 additions and 9 deletions
|
@ -15,6 +15,7 @@
|
|||
|
||||
int mufs_mkpath(struct mufs *fs, const char *path, unsigned type)
|
||||
{
|
||||
struct mufs_stat stat;
|
||||
struct mufs_dirent dirent;
|
||||
struct mufs_tree *tree;
|
||||
size_t len;
|
||||
|
@ -28,7 +29,7 @@ int mufs_mkpath(struct mufs *fs, const char *path, unsigned type)
|
|||
return -1;
|
||||
|
||||
/* TODO: already exists. */
|
||||
if (resolve_path(fs, s)) {
|
||||
if (resolve_path(fs, s, NULL)) {
|
||||
free(s);
|
||||
return 0;
|
||||
}
|
||||
|
@ -42,7 +43,7 @@ int mufs_mkpath(struct mufs *fs, const char *path, unsigned type)
|
|||
if (*name == '\0')
|
||||
return -1;
|
||||
|
||||
if (!(tree = resolve_path(fs, s)))
|
||||
if (!(tree = resolve_path(fs, s, &stat)) || stat.type != MUFS_DIR)
|
||||
return -1;
|
||||
|
||||
len = min(strlen(name), sizeof(dirent.path) - 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue