[augeas-devel] [PATCH 1 of 2] skel_instance_of: fix bad check for regexp match

David Lutterkort lutter at redhat.com
Fri Aug 29 04:39:19 UTC 2008


1 file changed, 6 insertions(+), 3 deletions(-)
src/put.c |    9 ++++++---


# HG changeset patch
# User David Lutterkort <dlutter at redhat.com>
# Date 1219984688 25200
# Node ID e0d63caa8d36b1abec2a47c4e5e59d54a8d6d6c8
# Parent  15b35d21a9a5bc598745825c8fd01aab3fe31262
skel_instance_of: fix bad check for regexp match

The return value of regexp_match was interpreted incorrectly, making it
seem that the skel_instance_of test should fail if we ever tried to match
an empty string.

diff -r 15b35d21a9a5 -r e0d63caa8d36 src/put.c
--- a/src/put.c	Wed Aug 27 15:58:30 2008 -0700
+++ b/src/put.c	Thu Aug 28 21:38:08 2008 -0700
@@ -320,11 +320,14 @@
         return 0;
 
     switch (lens->tag) {
-    case L_DEL:
+    case L_DEL: {
+        int count;
         if (skel->tag != L_DEL)
             return 0;
-        return regexp_match(lens->regexp, skel->text, strlen(skel->text),
-                            0, NULL);
+        count = regexp_match(lens->regexp, skel->text, strlen(skel->text),
+                           0, NULL);
+        return count == strlen(skel->text);
+    }
     case L_STORE:
         return skel->tag == L_STORE;
     case L_KEY:




More information about the augeas-devel mailing list