mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
virschematest: Replace g_lstat() with virFileIsLink()
Inside of virschematest.c there's testSchemaDir() which iterates
over dentries in given directory but skips some files: those
without ".xml" suffix, hidden files, symlinks, etc.
Now, symlinks are detected as g_lstat() + S_ISLNK() combo which
works, except it fails to compile on mingw where is no concept of
symlinks. Replace the combo with a call to virFileIsLink() which
at least allows us to compile cleanly on mingw.
Fixes: f997fcca71
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
48bdeaf2fa
commit
4d8ebbfee8
@ -119,14 +119,12 @@ testSchemaDir(const char *schema,
|
|||||||
while ((rc = virDirRead(dir, &ent, dir_path)) > 0) {
|
while ((rc = virDirRead(dir, &ent, dir_path)) > 0) {
|
||||||
g_autofree char *xml_path = NULL;
|
g_autofree char *xml_path = NULL;
|
||||||
bool exception = false;
|
bool exception = false;
|
||||||
GStatBuf sb;
|
|
||||||
|
|
||||||
if (!virStringHasSuffix(ent->d_name, ".xml"))
|
if (!virStringHasSuffix(ent->d_name, ".xml"))
|
||||||
continue;
|
continue;
|
||||||
if (ent->d_name[0] == '.')
|
if (ent->d_name[0] == '.')
|
||||||
continue;
|
continue;
|
||||||
if (g_lstat(ent->d_name, &sb) >= 0 &&
|
if (virFileIsLink(ent->d_name))
|
||||||
S_ISLNK(sb.st_mode))
|
|
||||||
continue;
|
continue;
|
||||||
if (filter &&
|
if (filter &&
|
||||||
!g_regex_match(filter, ent->d_name, 0, NULL))
|
!g_regex_match(filter, ent->d_name, 0, NULL))
|
||||||
|
Loading…
Reference in New Issue
Block a user