[libvirt] [sandbox v2 03/11] Enable strcmp checks in libvirt-sandbox-init-qemu.c

Cédric Bosdonnat cbosdonnat at suse.com
Mon Jun 29 16:44:11 UTC 2015


---
 cfg.mk                                      | 2 --
 libvirt-sandbox/libvirt-sandbox-init-qemu.c | 6 ++++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index 83ded15..37e5050 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -132,5 +132,3 @@ exclude_file_name_regexp--sc_libvirt_unmarked_diagnostics = ^libvirt-sandbox/tes
 exclude_file_name_regexp--sc_bindtextdomain = ^(libvirt-sandbox/tests)|(libvirt-sandbox/libvirt-sandbox-init-*)|(bin/virt-sandbox.c)|(bin/virt-sandbox-service-util.c)
 
 exclude_file_name_regexp--sc_preprocessor_indentation = ^*/*.[ch]
-
-exclude_file_name_regexp--sc_prohibit_strcmp = ^libvirt-sandbox/libvirt-sandbox-init-qemu.c
diff --git a/libvirt-sandbox/libvirt-sandbox-init-qemu.c b/libvirt-sandbox/libvirt-sandbox-init-qemu.c
index d5a0b7a..44305fd 100644
--- a/libvirt-sandbox/libvirt-sandbox-init-qemu.c
+++ b/libvirt-sandbox/libvirt-sandbox-init-qemu.c
@@ -51,6 +51,8 @@
 
 #define ATTR_UNUSED __attribute__((__unused__))
 
+#define STREQ(x,y) (strcmp(x,y) == 0)
+
 static void print_uptime (void);
 static void insmod (const char *filename);
 static void set_debug(void);
@@ -283,7 +285,7 @@ main(int argc ATTR_UNUSED, char **argv ATTR_UNUSED)
                     __func__, source, target, type, opts);
 
 
-        if (strcmp(type, "") == 0) {
+        if (STREQ(type, "")) {
             struct stat st;
             type = NULL;
             flags |= MS_BIND;
@@ -297,7 +299,7 @@ main(int argc ATTR_UNUSED, char **argv ATTR_UNUSED)
             else
                 mount_mkfile(target, 644);
         } else {
-            if (strcmp(type, "tmpfs") == 0)
+            if (STREQ(type, "tmpfs"))
                 flags |= MS_NOSUID | MS_NODEV;
 
             mount_mkdir(target, 0755);
-- 
2.1.4




More information about the libvir-list mailing list