mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Fix trailing slashes in manifests created by the kernel.
This commit is contained in:
parent
568c97c77f
commit
65a960dab0
1 changed files with 7 additions and 1 deletions
|
@ -626,8 +626,14 @@ static void ExtractTix(Ref<Descriptor> desc, struct initrd_context* ctx)
|
|||
{
|
||||
if ( strncmp(TAR.name, "data", 4) != 0 || TAR.name[4] != '/' )
|
||||
continue;
|
||||
if ( !(manifest_list[manifest_list_count++] = strdup(TAR.name + 4)) )
|
||||
char* path = strdup(TAR.name + 4);
|
||||
if ( !path )
|
||||
Panic("initrd tar malloc failure");
|
||||
size_t length = strlen(path);
|
||||
// Trim the trailing slash from directories.
|
||||
if ( 2 <= length && path[length-1] == '/' )
|
||||
path[length-1] = '\0';
|
||||
manifest_list[manifest_list_count++] = path;
|
||||
}
|
||||
CloseTar(&TAR);
|
||||
qsort(manifest_list, manifest_list_count, sizeof(char*), manifest_sort);
|
||||
|
|
Loading…
Reference in a new issue