mufs: update path resolution code in mufs_mkdir()
This commit is contained in:
parent
0e9474d377
commit
f1e6f8f278
1 changed files with 7 additions and 2 deletions
|
@ -244,19 +244,24 @@ int mufs_mkdir(struct mufs *fs, const char *path)
|
||||||
char *s;
|
char *s;
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
if (!path)
|
if (!path || *path == '\0')
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* TODO: already exists. */
|
/* TODO: already exists. */
|
||||||
if (resolve_path(fs, path))
|
if (resolve_path(fs, path))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
while (*path == '/')
|
||||||
|
++path;
|
||||||
|
|
||||||
|
printf("path=%s\n", path);
|
||||||
|
|
||||||
if (!(s = strdup(path)))
|
if (!(s = strdup(path)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!(name = strrchr(s, '/'))) {
|
if (!(name = strrchr(s, '/'))) {
|
||||||
name = s;
|
name = s;
|
||||||
s = NULL;
|
s = "/";
|
||||||
} else {
|
} else {
|
||||||
*name++ = '\0';
|
*name++ = '\0';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue