os/linux/ld: handle nonexistent ld.so.conf more gracefully

Fixes #18458
This commit is contained in:
Carlo Cabrera 2024-09-29 13:40:10 +08:00
parent d767c96ecb
commit 65731faf1d
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0

View File

@ -48,6 +48,8 @@ module OS
sig { params(conf_path: T.any(Pathname, String)).returns(T::Array[String]) }
def self.library_paths(conf_path = Pathname(sysconfdir)/"ld.so.conf")
conf_file = Pathname(conf_path)
return [] unless conf_file.exist?
paths = Set.new
directory = conf_file.realpath.dirname