mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-19 08:41:53 +00:00
Shell: Use lstat instead of access to check if glob target exists
Fixes #4905
This commit is contained in:
parent
b2b3ccb12d
commit
a90905c54c
Notes:
sideshowbarker
2024-07-18 23:53:23 +09:00
Author: https://github.com/alimpfard
Commit: a90905c54c
Pull-request: https://github.com/SerenityOS/serenity/pull/4923
Issue: https://github.com/SerenityOS/serenity/issues/4905
1 changed files with 4 additions and 3 deletions
|
@ -266,9 +266,10 @@ Vector<String> Shell::expand_globs(Vector<StringView> path_segments, const Strin
|
||||||
{
|
{
|
||||||
if (path_segments.is_empty()) {
|
if (path_segments.is_empty()) {
|
||||||
String base_str = base;
|
String base_str = base;
|
||||||
if (access(base_str.characters(), F_OK) == 0)
|
struct stat statbuf;
|
||||||
return { move(base_str) };
|
if (lstat(base_str.characters(), &statbuf) < 0)
|
||||||
return {};
|
return {};
|
||||||
|
return { move(base_str) };
|
||||||
}
|
}
|
||||||
|
|
||||||
auto first_segment = path_segments.take_first();
|
auto first_segment = path_segments.take_first();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue