mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 07:24:37 +00:00
Fix linux_newfstatat
"If pathname is absolute, then dirfd is ignored."
This commit is contained in:
parent
f5a6a39159
commit
fcccb5b44f
@ -2491,7 +2491,7 @@ static int linux_openat(SysFrm *, int dirfd, const char *pathname, int flags, mo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Undocumented? */
|
/* Undocumented? */
|
||||||
static long linux_newfstatat(SysFrm *, int dfd, const char *pathname,
|
static long linux_newfstatat(SysFrm *, int dirfd, const char *pathname,
|
||||||
struct stat *statbuf, int flag)
|
struct stat *statbuf, int flag)
|
||||||
{
|
{
|
||||||
/* FIXME: This function is not working at all? */
|
/* FIXME: This function is not working at all? */
|
||||||
@ -2508,7 +2508,9 @@ static long linux_newfstatat(SysFrm *, int dfd, const char *pathname,
|
|||||||
if (pPathname == nullptr || pStatbuf == nullptr)
|
if (pPathname == nullptr || pStatbuf == nullptr)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
if (dfd == AT_FDCWD)
|
debug("%s %#lx %#lx", pPathname, pathname, statbuf);
|
||||||
|
|
||||||
|
if (dirfd == AT_FDCWD && !fs->PathIsRelative(pPathname))
|
||||||
{
|
{
|
||||||
vfs::RefNode *absoluteNode = fs->Open(pPathname, pcb->CurrentWorkingDirectory);
|
vfs::RefNode *absoluteNode = fs->Open(pPathname, pcb->CurrentWorkingDirectory);
|
||||||
if (!absoluteNode)
|
if (!absoluteNode)
|
||||||
@ -2523,14 +2525,13 @@ static long linux_newfstatat(SysFrm *, int dfd, const char *pathname,
|
|||||||
}
|
}
|
||||||
|
|
||||||
vfs::FileDescriptorTable::Fildes &
|
vfs::FileDescriptorTable::Fildes &
|
||||||
fildes = fdt->GetDescriptor(dfd);
|
fildes = fdt->GetDescriptor(dirfd);
|
||||||
if (!fildes.Handle)
|
if (!fildes.Handle)
|
||||||
{
|
{
|
||||||
debug("Invalid fd %d", dfd);
|
debug("Invalid fd %d", dirfd);
|
||||||
return -EBADF;
|
return -EBADF;
|
||||||
}
|
}
|
||||||
|
|
||||||
debug("%s %#lx %#lx", pPathname, pathname, statbuf);
|
|
||||||
return fdt->_stat(pPathname, pStatbuf);
|
return fdt->_stat(pPathname, pStatbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user