From a90905c54c86c61a1c30d317a10a4b1b5c44f43c Mon Sep 17 00:00:00 2001 From: AnotherTest Date: Tue, 12 Jan 2021 17:45:26 +0330 Subject: [PATCH] Shell: Use lstat instead of access to check if glob target exists Fixes #4905 --- Userland/Shell/Shell.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Userland/Shell/Shell.cpp b/Userland/Shell/Shell.cpp index 5be7baea2d..34ca31c0f2 100644 --- a/Userland/Shell/Shell.cpp +++ b/Userland/Shell/Shell.cpp @@ -266,9 +266,10 @@ Vector Shell::expand_globs(Vector path_segments, const Strin { if (path_segments.is_empty()) { String base_str = base; - if (access(base_str.characters(), F_OK) == 0) - return { move(base_str) }; - return {}; + struct stat statbuf; + if (lstat(base_str.characters(), &statbuf) < 0) + return {}; + return { move(base_str) }; } auto first_segment = path_segments.take_first();