[libvirt] [PATCH] tests: Fix build with clang

Jiri Denemark jdenemar at redhat.com
Thu Oct 5 07:11:13 UTC 2017


clang doesn't like mode_t type as an argument to va_arg():

error: second argument to 'va_arg' is of promotable type 'mode_t' (aka
'unsigned short'); this va_arg has undefined behavior because arguments
will be promoted to 'int'

    mode = va_arg(ap, mode_t);
                      ^~~~~~

Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---

Pushed as a build-breaker.

 tests/virfilewrapper.c | 2 +-
 tests/virusbmock.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/virfilewrapper.c b/tests/virfilewrapper.c
index 1d1d182708..3fd7f7aa8f 100644
--- a/tests/virfilewrapper.c
+++ b/tests/virfilewrapper.c
@@ -267,7 +267,7 @@ int open(const char *path, int flags, ...)
      */
     if (flags & O_CREAT) {
         va_start(ap, flags);
-        mode = va_arg(ap, mode_t);
+        mode = (mode_t) va_arg(ap, int);
         va_end(ap);
     }
 
diff --git a/tests/virusbmock.c b/tests/virusbmock.c
index f430a2edad..12083e2362 100644
--- a/tests/virusbmock.c
+++ b/tests/virusbmock.c
@@ -101,7 +101,7 @@ int open(const char *pathname, int flags, ...)
      */
     if (flags & O_CREAT) {
         va_start(ap, flags);
-        mode = va_arg(ap, mode_t);
+        mode = (mode_t) va_arg(ap, int);
         va_end(ap);
     }
 
-- 
2.14.2




More information about the libvir-list mailing list