mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +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$$
|
||||
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user