[PATCH 11/18] Prohibit opendir in syntax-check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Prefer virDirOpen.
---
 cfg.mk             | 7 +++++--
 src/util/virfile.c | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index a2576d1..de1c1da 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -421,9 +421,9 @@ sc_prohibit_gethostname:
 	  $(_sc_search_regexp)
 
 sc_prohibit_readdir:
-	@prohibit='\b(read|close)dir *\('				\
+	@prohibit='\b(read|close|open)dir *\('				\
 	exclude='exempt from syntax-check'				\
-	halt='use virDirRead and VIR_DIR_CLOSE'				\
+	halt='use virDirOpen, virDirRead and VIR_DIR_CLOSE'		\
 	  $(_sc_search_regexp)
 
 sc_prohibit_gettext_noop:
@@ -1293,3 +1293,6 @@ exclude_file_name_regexp--sc_prohibit_dt_without_code = \
 
 exclude_file_name_regexp--sc_prohibit_always-defined_macros = \
   ^tests/virtestmock.c$$
+
+exclude_file_name_regexp--sc_prohibit_readdir = \
+  ^tests/.*mock\.c$$
diff --git a/src/util/virfile.c b/src/util/virfile.c
index f6c43d4..1820e80 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -2729,7 +2729,7 @@ virFileRemove(const char *path,
 static int
 virDirOpenInternal(DIR **dirp, const char *name, bool ignoreENOENT, bool quiet)
 {
-    *dirp = opendir(name);
+    *dirp = opendir(name); /* exempt from syntax-check */
     if (!*dirp) {
         if (quiet)
             return -1;
-- 
2.7.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]