aboutsummaryrefslogtreecommitdiffstats
path: root/agent/findkey.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--agent/findkey.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/agent/findkey.c b/agent/findkey.c
index 86a28d511..0b5816bf5 100644
--- a/agent/findkey.c
+++ b/agent/findkey.c
@@ -166,9 +166,7 @@ modify_description (const char *in, const char *comment, char **result)
special = 0;
for (i = 0; i < in_len; i++)
{
- if (in[i] == '%')
- special = 1;
- else if (special)
+ if (special)
{
special = 0;
switch (in[i])
@@ -190,10 +188,19 @@ modify_description (const char *in, const char *comment, char **result)
out_len += comment_length;
break;
- default: /* Invalid special sequences are ignored. */
+ default: /* Invalid special sequences are kept as they are. */
+ if (out)
+ {
+ *out++ = '%';
+ *out++ = in[i];
+ }
+ else
+ out_len+=2;
break;
}
}
+ else if (in[i] == '%')
+ special = 1;
else
{
if (out)