From 4cab804e856271a0da9a5aac4c50b632818dd4ee Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Wed, 19 Oct 2022 09:35:14 +0200 Subject: [PATCH] Utils: Don't return self during find find can return the directory that is searched in as one of the results. We need to filter it out. Change-Id: If2902497e67d3a7a216430e725ec86227a392ccb Reviewed-by: hjk --- src/libs/utils/devicefileaccess.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libs/utils/devicefileaccess.cpp b/src/libs/utils/devicefileaccess.cpp index 6123cd6751c..517004f2732 100644 --- a/src/libs/utils/devicefileaccess.cpp +++ b/src/libs/utils/devicefileaccess.cpp @@ -879,6 +879,9 @@ bool UnixDeviceFileAccess::iterateWithFind( return true; const FilePath fp = filePath.withNewPath(fileName); + // Do not return the entry for the directory we are searching in. + if (fp.path() == filePath.path()) + return true; return std::get<1>(callBack)(fp, fi); };