mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:17:35 +00:00
LibC: realpath() should assume the buffer is PATH_MAX bytes
This commit is contained in:
parent
f28fa616eb
commit
9470db92f4
1 changed files with 2 additions and 6 deletions
|
@ -591,13 +591,9 @@ int umount(const char* mountpoint)
|
||||||
|
|
||||||
char* realpath(const char* pathname, char* buffer)
|
char* realpath(const char* pathname, char* buffer)
|
||||||
{
|
{
|
||||||
size_t size;
|
size_t size = PATH_MAX;
|
||||||
if (buffer == nullptr) {
|
if (buffer == nullptr)
|
||||||
size = PATH_MAX;
|
|
||||||
buffer = (char*)malloc(size);
|
buffer = (char*)malloc(size);
|
||||||
} else {
|
|
||||||
size = sizeof(buffer);
|
|
||||||
}
|
|
||||||
int rc = syscall(SC_realpath, pathname, buffer, size);
|
int rc = syscall(SC_realpath, pathname, buffer, size);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
errno = -rc;
|
errno = -rc;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue