Remove all the remaining usage of opendir.
if (conf_dir == NULL)
return -1;
- dp = opendir(conf_dir);
- if (dp == NULL) {
+ if (virDirOpenQuiet(&dp, conf_dir) < 0) {
VIR_FREE(conf_dir);
return 0;
}
int direrr;
/* condition 1 - /sys/kernel/iommu_groups/ contains entries */
- if (!(iommuDir = opendir("/sys/kernel/iommu_groups/")))
+ if (virDirOpenQuiet(&iommuDir, "/sys/kernel/iommu_groups/") < 0)
goto cleanup;
while ((direrr = virDirRead(iommuDir, &iommuGroup, NULL)) > 0) {
* get created.
*/
reopen:
- if ((dh = opendir(pool->def->target.path)) == NULL) {
+ if (virDirOpenQuiet(&dh, pool->def->target.path) < 0) {
opentries++;
if (loop && errno == ENOENT && opentries < 50) {
usleep(100 * 1000);
int rc = 0;
int direrr;
- grpdir = opendir(grppath);
- if (grpdir == NULL) {
+ if (virDirOpenQuiet(&grpdir, grppath) < 0) {
if (errno == ENOENT)
return 0;
rc = -errno;
if (virAsprintf(&sysfs_nodedir, "%s/node", sysfs_system_path) < 0)
goto cleanup;
- if (!(nodedir = opendir(sysfs_nodedir))) {
+ if (virDirOpenQuiet(&nodedir, sysfs_nodedir) < 0) {
/* the host isn't probably running a NUMA architecture */
goto fallback;
}
orig->domain, orig->bus, orig->slot, orig->function) < 0)
goto cleanup;
- if (!(groupDir = opendir(groupPath))) {
+ if (virDirOpenQuiet(&groupDir, groupPath) < 0) {
/* just process the original device, nothing more */
ret = (actor)(orig, opaque);
goto cleanup;
return -1;
}
- dir = opendir(pcidev_sysfs_net_path);
- if (dir == NULL)
+ if (virDirOpenQuiet(&dir, pcidev_sysfs_net_path) < 0)
goto out;
while (virDirRead(dir, &entry, pcidev_sysfs_net_path) > 0) {
}
- if (!(dir = opendir(leaseDir))) {
+ if (virDirOpenQuiet(&dir, leaseDir) < 0) {
ERROR("Failed to open dir '%s'", leaseDir);
goto cleanup;
}