mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
Userland: Fail Core::find_executable_in_path on empty inputs
Before this patch, `which ""` or `type ""` would say that the empty string is `/usr/local/bin/`. Convert callers to consistently call is_empty() on the returned string while we're at it, to support eventually removing the is_null() String state in the future.
This commit is contained in:
committed by
Brian Gianforcaro
parent
7f9bd34d07
commit
170a7e263c
@@ -97,6 +97,9 @@ String DirIterator::next_full_path()
|
||||
|
||||
String find_executable_in_path(String filename)
|
||||
{
|
||||
if (filename.is_empty())
|
||||
return {};
|
||||
|
||||
if (filename.starts_with('/')) {
|
||||
if (access(filename.characters(), X_OK) == 0)
|
||||
return filename;
|
||||
|
||||
Reference in New Issue
Block a user