vfs: handle odd edge case in mkdir correctly
This commit is contained in:
parent
232128bc3e
commit
40be4f1703
@ -423,6 +423,10 @@ int mkdir_fs(char *name, uint16_t permission) {
|
||||
char *cwd = (char *)(current_process->wd_name);
|
||||
char *path = canonicalize_path(cwd, name);
|
||||
|
||||
if (!name || !strlen(name)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
char * parent_path = malloc(strlen(path) + 4);
|
||||
sprintf(parent_path, "%s/..", path);
|
||||
|
||||
@ -455,6 +459,11 @@ int mkdir_fs(char *name, uint16_t permission) {
|
||||
return -EACCES;
|
||||
}
|
||||
|
||||
if (!f_path || !strlen(f_path)) {
|
||||
/* Odd edge case with / */
|
||||
return -EEXIST;
|
||||
}
|
||||
|
||||
int ret = 0;
|
||||
if (parent->mkdir) {
|
||||
ret = parent->mkdir(parent, f_path, permission);
|
||||
|
Loading…
x
Reference in New Issue
Block a user