mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-23 04:55:15 +00:00
Fix crash when doing "ls -l" in the /proc/PID directory for a kernel process.
This commit is contained in:
parent
0d36281162
commit
bad2fe33ad
Notes:
sideshowbarker
2024-07-19 16:06:04 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/bad2fe33ade
1 changed files with 4 additions and 1 deletions
|
@ -32,6 +32,8 @@ ProcFS::~ProcFS()
|
|||
ByteBuffer procfs$pid_fds(Process& process)
|
||||
{
|
||||
ProcessInspectionHandle handle(process);
|
||||
if (process.number_of_open_file_descriptors() == 0)
|
||||
return { };
|
||||
char* buffer;
|
||||
auto stringImpl = StringImpl::create_uninitialized(process.number_of_open_file_descriptors() * 80, buffer);
|
||||
memset(buffer, 0, stringImpl->length());
|
||||
|
@ -181,7 +183,8 @@ void ProcFS::add_process(Process& process)
|
|||
add_file(create_generated_file("fds", [&process] { return procfs$pid_fds(process); }), dir.index());
|
||||
if (process.executable_inode())
|
||||
add_file(create_generated_file("exe", [&process] { return procfs$pid_exe(process); }, 00120777), dir.index());
|
||||
add_file(create_generated_file("cwd", [&process] { return procfs$pid_cwd(process); }, 00120777), dir.index());
|
||||
if (process.cwd_inode())
|
||||
add_file(create_generated_file("cwd", [&process] { return procfs$pid_cwd(process); }, 00120777), dir.index());
|
||||
}
|
||||
|
||||
void ProcFS::remove_process(Process& process)
|
||||
|
|
Loading…
Add table
Reference in a new issue