Prohibit opendir in syntax-check

Prefer virDirOpen.
This commit is contained in:
Ján Tomko 2016-06-21 16:53:42 +02:00
parent 994b024624
commit 32d0a57812
2 changed files with 6 additions and 3 deletions

7
cfg.mk
View File

@ -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:
@ -1265,3 +1265,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$$

View File

@ -2725,7 +2725,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;