upgpkg: wordpress 6.2.1-1
[ArchLinux/community.git] / incron / trunk / 0001-GetSafePath.patch
bloba2451934a9bb1aafddc3ec390c7dbe20b725ee88
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
7 append the character.
8 ---
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
14 --- a/incrontab.cpp
15 +++ b/incrontab.cpp
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] == ' ') {
21 - stream << "\\ ";
22 - }
23 - else if (rPath[i] == '\\') {
24 - stream << "\\\\";
25 - }
26 - else {
27 - stream << rPath[i];
28 + if (rPath[i] == ' ' ||
29 + rPath[i] == '\\') {
30 + stream << "\\";
32 + stream << rPath[i];
35 return stream.str();
36 --
37 2.36.0
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
44 brackets
46 This fixes...
48 incrond[1714]: cannot exec process: Resource temporarily unavailable
50 ... with bad file name due to messing escaping.
51 ---
52 incrontab.cpp | 6 ++++++
53 1 file changed, 6 insertions(+)
55 diff --git a/incrontab.cpp b/incrontab.cpp
56 index 613aad4..8b951da 100644
57 --- a/incrontab.cpp
58 +++ b/incrontab.cpp
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] == ' ' ||
63 + rPath[i] == '\'' ||
64 + rPath[i] == '"' ||
65 + rPath[i] == '(' ||
66 + rPath[i] == ')' ||
67 + rPath[i] == '<' ||
68 + rPath[i] == '>' ||
69 rPath[i] == '\\') {
70 stream << "\\";
72 --
73 2.36.0