[PATCH] tests: virpcimock: Always declare __open_2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In some cases e.g. with clang on fedora 30 __open2 isn't even declared
which results in the following build error:

/home/pipo/libvirt/tests/virpcimock.c:939:1: error: no previous prototype for function
      '__open_2' [-Werror,-Wmissing-prototypes]
__open_2(const char *path, int flags)

Add a separate declaration to appease the compiler.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tests/virpcimock.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/virpcimock.c b/tests/virpcimock.c
index 829d61cd3f..cfe91ba3ff 100644
--- a/tests/virpcimock.c
+++ b/tests/virpcimock.c
@@ -935,6 +935,11 @@ open(const char *path, int flags, ...)
 }


+/* in some cases this function may not be present in headers, so we need
+ * a declaration to silence the complier */
+int
+__open_2(const char *path, int flags);
+
 int
 __open_2(const char *path, int flags)
 {
-- 
2.21.0

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux