[augeas-devel] [Augeas][PATCH] augtool: Fix return value issue

Alex Jia ajia at redhat.com
Tue Apr 9 10:03:07 UTC 2013


Whether or not the "disk_lease_dir" is configured in 
/etc/libvirt/qemu-sanlock.conf, the augtool always 
exits with zero status, although the 'code' is 1 in
augtool.c.

How to reproduce?

$ grep "disk_lease_dir =" /etc/libvirt/qemu-sanlock.conf                  
#disk_lease_dir = "/var/lib/libvirt/sanlock"

$ sh -x test.sh
++ augtool print /files/etc/libvirt/qemu-sanlock.conf/disk_lease_dir
+ LOCKDIR=
+ test 0 '!=' 0
+ test x = x
+ LOCKDIR=/var/lib/libvirt/sanlock

Signed-off-by: Alex Jia <ajia at redhat.com>
---
 src/augtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/augtool.c b/src/augtool.c
index 9ec3839..295a145 100644
--- a/src/augtool.c
+++ b/src/augtool.c
@@ -554,7 +554,7 @@ static int run_args(int argc, char **argv) {
         code = -1;
         print_aug_error();
     }
-    return (code >= 0 || code == -2) ? 0 : -1;
+    return (code == 0 || code == -2) ? 0 : -1;
 }
 
 static void add_transforms(char *ts, size_t tslen) {
-- 
1.8.1.4




More information about the augeas-devel mailing list