mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-28 23:39:02 +00:00
LibFileSystem: Replace PATH_MAX usage with heap allocation
This commit is contained in:
parent
4825919bcf
commit
ae10d085ba
Notes:
sideshowbarker
2024-07-16 20:21:48 +09:00
Author: https://github.com/bugaevc
Commit: ae10d085ba
Pull-request: https://github.com/SerenityOS/serenity/pull/20958
Reviewed-by: https://github.com/ADKaster ✅
1 changed files with 3 additions and 2 deletions
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibFileSystem/FileSystem.h>
|
||||
|
@ -47,9 +48,9 @@ ErrorOr<String> real_path(StringView path)
|
|||
if (path.is_null())
|
||||
return Error::from_errno(ENOENT);
|
||||
|
||||
char buffer[PATH_MAX];
|
||||
DeprecatedString dep_path = path;
|
||||
auto* real_path = realpath(dep_path.characters(), buffer);
|
||||
char* real_path = realpath(dep_path.characters(), nullptr);
|
||||
ScopeGuard free_path = [real_path]() { free(real_path); };
|
||||
|
||||
if (!real_path)
|
||||
return Error::from_syscall("realpath"sv, -errno);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue