提交 b6a2bd4a 编写于 作者: D Daniel P. Berrangé

nss: remove use for virDir helper APIs

Use the plain libc APIs to avoid a dependancy on the main libvirt
code from the nss module.
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 2b0d5976
......@@ -1338,7 +1338,7 @@ exclude_file_name_regexp--sc_prohibit_always-defined_macros = \
^tests/virtestmock.c$$
exclude_file_name_regexp--sc_prohibit_readdir = \
^tests/(.*mock|virfilewrapper)\.c$$
^(tests/(.*mock|virfilewrapper)\.c|tools/nss/libvirt_nss\.c)$$
exclude_file_name_regexp--sc_prohibit_cross_inclusion = \
^(src/util/virclosecallbacks\.h|src/util/virhostdev\.h)$$
......
......@@ -281,7 +281,8 @@ findLease(const char *name,
goto cleanup;
}
if (virDirOpenQuiet(&dir, leaseDir) < 0) {
dir = opendir(leaseDir);
if (!dir) {
ERROR("Failed to open dir '%s'", leaseDir);
goto cleanup;
}
......@@ -292,7 +293,7 @@ findLease(const char *name,
}
DEBUG("Dir: %s", leaseDir);
while ((ret = virDirRead(dir, &entry, leaseDir)) > 0) {
while ((entry = readdir(dir)) != NULL) {
char *path;
if (virStringHasSuffix(entry->d_name, ".status")) {
......@@ -324,8 +325,11 @@ findLease(const char *name,
nMacmaps++;
VIR_FREE(path);
}
errno = 0;
}
VIR_DIR_CLOSE(dir);
closedir(dir);
dir = NULL;
nleases = virJSONValueArraySize(leases_array);
DEBUG("Read %zd leases", nleases);
......@@ -363,7 +367,8 @@ findLease(const char *name,
cleanup:
*errnop = errno;
VIR_DIR_CLOSE(dir);
if (dir)
closedir(dir);
while (nMacmaps)
virObjectUnref(macmaps[--nMacmaps]);
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册