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

Cédric Bosdonnat cbosdonnat at suse.com
Thu Jun 25 16:49:40 UTC 2015


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

diff --git a/cfg.mk b/cfg.mk
index 83ded15..e9c12f7 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -133,4 +133,4 @@ exclude_file_name_regexp--sc_bindtextdomain = ^(libvirt-sandbox/tests)|(libvirt-
 
 exclude_file_name_regexp--sc_preprocessor_indentation = ^*/*.[ch]
 
-exclude_file_name_regexp--sc_prohibit_strcmp = ^libvirt-sandbox/libvirt-sandbox-init-qemu.c
+#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 a20db77..db67fdb 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);
@@ -375,7 +377,7 @@ main(int argc ATTR_UNUSED, char **argv ATTR_UNUSED)
         if (strncmp(source, "/dev/vd", 7) == 0)
             create_virtioblk_device(source);
 
-        if (strcmp(type, "") == 0) {
+        if (STREQ(type, "")) {
             struct stat st;
             type = NULL;
             flags |= MS_BIND;
@@ -389,7 +391,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