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