Preview mkdir from creating directories that already exist

This commit is contained in:
Kevin Lange 2016-09-18 21:19:20 +09:00
parent 4fbf2afa67
commit 6297bac128

View File

@ -327,6 +327,13 @@ int mkdir_fs(char *name, uint16_t permission) {
char * parent_path = malloc(strlen(path) + 4);
sprintf(parent_path, "%s/..", path);
fs_node_t * this = kopen(path, 0);
if (this) {
debug_print(ERROR, "Tried to mkdir a dir that already exists? (%s)", path);
close_fs(this);
return -EEXIST;
}
char * f_path = path + strlen(path) - 1;
while (f_path > path) {
if (*f_path == '/') {