Skip to content
Snippets Groups Projects
Commit fd4d7595 authored by Byron Lathi's avatar Byron Lathi
Browse files

use a copy of filename so it won't overwrite

parent 221a836e
No related branches found
No related tags found
No related merge requests found
......@@ -146,9 +146,14 @@ uint32_t ext2_parse_path_to_inode_num(int8_t* filename)
return -1;
}
int8_t _tmpfilename[128];
int8_t* tmpfilename = _tmpfilename; //kind of a hack
strcpy(filename, tmpfilename);
// ignore the first slash, since we know its there
filename++;
int8_t* end_pointer = filename;
tmpfilename++;
int8_t* end_pointer = tmpfilename;
int more_to_do = 1;
......@@ -172,10 +177,10 @@ uint32_t ext2_parse_path_to_inode_num(int8_t* filename)
// this will now find the first entry in the root directory
inode = ext2_find_inode_num2(filename, inode);
inode = ext2_find_inode_num2(tmpfilename, inode);
if (!inode) {
printf("File not found: %s\n", filename);
printf("File not found: %s\n", tmpfilename);
return inode;
}
......@@ -186,7 +191,7 @@ uint32_t ext2_parse_path_to_inode_num(int8_t* filename)
// might as well stop that even if they are out of scope soon
if (more_to_do) {
end_pointer++;
filename = end_pointer;
tmpfilename = end_pointer;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment