shithub: riscv

Download patch

ref: db971a6189e63802b4c7c0ee41bf00e9864f52a7
parent: e54b6c6cbd4d82d70ddb4932aeafb0b028cd71f5
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Oct 23 09:40:06 EDT 2021

kernel: fix stat bugs

In a few places, we where using a fixed buffer of sizeof(Dir)+100
size for stat. This is not correct and fails if the name returned
in stat is long.

This results in being unable to seek to the end of file with a
long filename.

The kernel should do the same thing as dirfstat() from libc;
handling the conversion and buffer allocation and returning a
freeable Dir* pointer.

For this, a new dirchanstat() function was added.

The fstat syscall was not rewriting the name to the last path
element; fix it.

In addition, gracefully handle the mountfix case, reallocating
the buffer to accomidate the required stat length plus
size of the new name so dirsetname() does not fail.