From 4d8ebbfee83edb26b19a62465b9f98d0126db991 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Tue, 27 Aug 2024 14:14:37 +0200 Subject: [PATCH] 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: f997fcca71a16b102e6ee663a3fb86bed8de9d7d Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- tests/virschematest.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/virschematest.c b/tests/virschematest.c index 20ac495f4a..5d3fa32de4 100644 --- a/tests/virschematest.c +++ b/tests/virschematest.c @@ -119,14 +119,12 @@ testSchemaDir(const char *schema, while ((rc = virDirRead(dir, &ent, dir_path)) > 0) { g_autofree char *xml_path = NULL; bool exception = false; - GStatBuf sb; if (!virStringHasSuffix(ent->d_name, ".xml")) continue; if (ent->d_name[0] == '.') continue; - if (g_lstat(ent->d_name, &sb) >= 0 && - S_ISLNK(sb.st_mode)) + if (virFileIsLink(ent->d_name)) continue; if (filter && !g_regex_match(filter, ent->d_name, 0, NULL))