[augeas-devel] augeas: master - * src/put.c (put_store): escape regexp before printing

David Lutterkort lutter at fedoraproject.org
Fri Jun 5 20:13:19 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=3237d5c50a4c021306b41250cbb14077f5345975
Commit:        3237d5c50a4c021306b41250cbb14077f5345975
Parent:        41320231f5b0de775817fea366f699abcdcc5894
Author:        David Lutterkort <lutter at redhat.com>
AuthorDate:    Fri Jun 5 12:37:46 2009 -0700
Committer:     David Lutterkort <lutter at redhat.com>
CommitterDate: Fri Jun 5 12:37:46 2009 -0700

* src/put.c (put_store): escape regexp before printing

---
 src/put.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/put.c b/src/put.c
index a305890..26483df 100644
--- a/src/put.c
+++ b/src/put.c
@@ -515,9 +515,11 @@ static void put_store(struct lens *lens, struct state *state) {
                   "Can not store a nonexistent (NULL) value");
     } else if (regexp_match(lens->regexp, state->value, strlen(state->value),
                             0, NULL) != strlen(state->value)) {
+        char *pat = regexp_escape(lens->regexp);
         put_error(state, lens,
                   "Value '%s' does not match regexp /%s/ in store lens",
-                  state->value, lens->regexp->pattern->str);
+                  state->value, pat);
+        free(pat);
     } else {
         fprintf(state->out, "%s", state->value);
     }




More information about the augeas-devel mailing list