mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
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: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
2b0d597670
commit
b6a2bd4ac0
2
cfg.mk
2
cfg.mk
@ -1338,7 +1338,7 @@ exclude_file_name_regexp--sc_prohibit_always-defined_macros = \
|
|||||||
^tests/virtestmock.c$$
|
^tests/virtestmock.c$$
|
||||||
|
|
||||||
exclude_file_name_regexp--sc_prohibit_readdir = \
|
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 = \
|
exclude_file_name_regexp--sc_prohibit_cross_inclusion = \
|
||||||
^(src/util/virclosecallbacks\.h|src/util/virhostdev\.h)$$
|
^(src/util/virclosecallbacks\.h|src/util/virhostdev\.h)$$
|
||||||
|
@ -281,7 +281,8 @@ findLease(const char *name,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virDirOpenQuiet(&dir, leaseDir) < 0) {
|
dir = opendir(leaseDir);
|
||||||
|
if (!dir) {
|
||||||
ERROR("Failed to open dir '%s'", leaseDir);
|
ERROR("Failed to open dir '%s'", leaseDir);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -292,7 +293,7 @@ findLease(const char *name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEBUG("Dir: %s", leaseDir);
|
DEBUG("Dir: %s", leaseDir);
|
||||||
while ((ret = virDirRead(dir, &entry, leaseDir)) > 0) {
|
while ((entry = readdir(dir)) != NULL) {
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
if (virStringHasSuffix(entry->d_name, ".status")) {
|
if (virStringHasSuffix(entry->d_name, ".status")) {
|
||||||
@ -324,8 +325,11 @@ findLease(const char *name,
|
|||||||
nMacmaps++;
|
nMacmaps++;
|
||||||
VIR_FREE(path);
|
VIR_FREE(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
VIR_DIR_CLOSE(dir);
|
closedir(dir);
|
||||||
|
dir = NULL;
|
||||||
|
|
||||||
nleases = virJSONValueArraySize(leases_array);
|
nleases = virJSONValueArraySize(leases_array);
|
||||||
DEBUG("Read %zd leases", nleases);
|
DEBUG("Read %zd leases", nleases);
|
||||||
@ -363,7 +367,8 @@ findLease(const char *name,
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
*errnop = errno;
|
*errnop = errno;
|
||||||
VIR_DIR_CLOSE(dir);
|
if (dir)
|
||||||
|
closedir(dir);
|
||||||
while (nMacmaps)
|
while (nMacmaps)
|
||||||
virObjectUnref(macmaps[--nMacmaps]);
|
virObjectUnref(macmaps[--nMacmaps]);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user