1 From 47263e66497eaff3a83873080fa4b76bd5f6ad7d Mon Sep 17 00:00:00 2001
2 From: Christian Hesse <mail@eworm.de>
3 Date: Fri, 29 Apr 2022 00:00:09 +0200
4 Subject: [PATCH 1/2] simplify code
6 No need for a lot of if-else... Just add a backslash if required, then
9 incrontab.cpp | 12 ++++--------
10 1 file changed, 4 insertions(+), 8 deletions(-)
12 diff --git a/incrontab.cpp b/incrontab.cpp
13 index 5255163..613aad4 100644
16 @@ -168,15 +168,11 @@ std::string IncronTabEntry::GetSafePath(const std::string& rPath)
18 SIZE len = rPath.length();
19 for (SIZE i = 0; i < len; i++) {
20 - if (rPath[i] == ' ') {
23 - else if (rPath[i] == '\\') {
28 + if (rPath[i] == ' ' ||
40 From 35f4298d574151deadbdeb7ccc7785bf36504d3d Mon Sep 17 00:00:00 2001
41 From: Christian Hesse <mail@eworm.de>
42 Date: Fri, 29 Apr 2022 00:02:18 +0200
43 Subject: [PATCH 2/2] also escape single & double quotes, parenthesis and angle
48 incrond[1714]: cannot exec process: Resource temporarily unavailable
50 ... with bad file name due to messing escaping.
52 incrontab.cpp | 6 ++++++
53 1 file changed, 6 insertions(+)
55 diff --git a/incrontab.cpp b/incrontab.cpp
56 index 613aad4..8b951da 100644
59 @@ -169,6 +169,12 @@ std::string IncronTabEntry::GetSafePath(const std::string& rPath)
60 SIZE len = rPath.length();
61 for (SIZE i = 0; i < len; i++) {
62 if (rPath[i] == ' ' ||