Skip to content

Commit b3a6919

Browse files
author
Thomas Goodwin
committed
replace const ref with const value in FileSystem_impl::remove()
It may sometimes be permissible to assign the by-value result of a function to a const reference, but in this case it was getting garbage data and causing the filename check to fail. (see Geontech/core-framework@30af902) Signed-off-by: Thomas Goodwin <btgoodwin@geontech.com>
1 parent dd1988e commit b3a6919

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Index: src/control/framework/FileSystem_impl.cpp
2+
===================================================================
3+
--- src.orig/control/framework/FileSystem_impl.cpp
4+
+++ src/control/framework/FileSystem_impl.cpp
5+
@@ -177,7 +177,7 @@ void FileSystem_impl::remove (const char
6+
7+
const fs::directory_iterator end_itr; // an end iterator (by boost definition)
8+
for (fs::directory_iterator itr = fsops.begin(dirPath); itr != end_itr; fsops.increment(itr)) {
9+
- const std::string& filename = BOOST_PATH_STRING(itr->path().filename());
10+
+ const std::string filename = BOOST_PATH_STRING(itr->path().filename());
11+
if (fnmatch(searchPattern.c_str(), filename.c_str(), 0) == 0) {
12+
RH_TRACE(_fileSysLog, "Removing file " << itr->path().string());
13+
if (!fsops.remove(itr->path())) {

recipes-core/core-framework/redhawk_2.2.3.bb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ SRC_URI_append = "\
6565
file://signalling.patch \
6666
file://dlopen_reverse_order.patch \
6767
file://bare-python2-references.patch \
68+
file://filesystem_impl-const-value.patch \
6869
"
6970

7071
S = "${WORKDIR}/git/redhawk/src"

0 commit comments

Comments
 (0)