tools-utils: Avoid endless loop

* src/abg-tools-utils.cc (is_dir): Avoid endless loop.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2023-09-05 18:27:29 +02:00
parent 4071543456
commit 4a7416ade4
1 changed files with 11 additions and 3 deletions

View File

@ -567,10 +567,18 @@ is_dir(const string& path)
if (S_ISDIR(st.st_mode))
return true;
if (S_ISLNK(st.st_mode))
{
string symlink_target_path;
if (maybe_get_symlink_target_file_path(path, symlink_target_path))
return is_dir(symlink_target_path);
{
if (!get_stat(path, &st))
return false;
if (S_ISDIR(st.st_mode))
return true;
}
}
return false;
}