[libvirt] [PATCH] tests: fix virfilewrapper

Roman Bogorodskiy posted 1 patch 6 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20170509131319.18950-1-bogorodskiy@gmail.com
tests/virfilewrapper.c | 4 ++++
1 file changed, 4 insertions(+)
[libvirt] [PATCH] tests: fix virfilewrapper
Posted by Roman Bogorodskiy 6 years, 10 months ago
If __lxstat() and __xstat() functions are not available, build fails with:

  CC       virfilewrapper.o
virfilewrapper.c:180:5: error: no previous prototype for function '__lxstat' [-Werror,-Wmissing-prototypes]
int __lxstat(int ver, const char *path, struct stat *sb)
    ^
virfilewrapper.c:208:5: error: no previous prototype for function '__xstat' [-Werror,-Wmissing-prototypes]
int __xstat(int ver, const char *path, struct stat *sb)

Luckily, we already check presence of these functions in configure
using AC_CHECK_FUNCS, so just don't wrap these if they're not available.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
---
Pushed under build-breaker fix.

 tests/virfilewrapper.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/virfilewrapper.c b/tests/virfilewrapper.c
index 75c32bfca..5ea70b34d 100644
--- a/tests/virfilewrapper.c
+++ b/tests/virfilewrapper.c
@@ -177,6 +177,7 @@ int access(const char *path, int mode)
     return ret;
 }
 
+#ifdef HAVE___LXSTAT
 int __lxstat(int ver, const char *path, struct stat *sb)
 {
     int ret = -1;
@@ -190,6 +191,7 @@ int __lxstat(int ver, const char *path, struct stat *sb)
 
     return ret;
 }
+#endif /* HAVE___LXSTAT */
 
 int lstat(const char *path, struct stat *sb)
 {
@@ -205,6 +207,7 @@ int lstat(const char *path, struct stat *sb)
     return ret;
 }
 
+#ifdef HAVE___XSTAT
 int __xstat(int ver, const char *path, struct stat *sb)
 {
     int ret = -1;
@@ -218,6 +221,7 @@ int __xstat(int ver, const char *path, struct stat *sb)
 
     return ret;
 }
+#endif /* HAVE___XSTAT */
 
 int stat(const char *path, struct stat *sb)
 {
-- 
2.12.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list