Boot loader VFS: fix string termination error.

The code was resetting the pointer to NULL, instead of setting the
pointed char to null-terminate the string. The result was resolving the
current directory later on, instead of the parent as requested.

This only happened when calling open_from with O_CREAT, and a name with
sub-directories inside it. The boot loader never does that, so the code
wasn't used until now.

Fixes #12941.

Thanks to mt for spotting the problem.
This commit is contained in:
Adrien Destugues 2016-09-17 11:15:00 +02:00
parent 99750e3182
commit ed1b81b72b

View File

@ -1044,7 +1044,7 @@ open_from(Directory *directory, const char *name, int mode, mode_t permissions)
if (lastSlash[1] == '\0')
return B_ENTRY_NOT_FOUND;
lastSlash = '\0';
*lastSlash = '\0';
name = lastSlash + 1;
// resolve the directory