]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: Fix build with clang
authorJiri Denemark <jdenemar@redhat.com>
Thu, 5 Oct 2017 07:06:03 +0000 (09:06 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 5 Oct 2017 07:09:50 +0000 (09:09 +0200)
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@redhat.com>
tests/virfilewrapper.c
tests/virusbmock.c

index 1d1d1827086de3e6e5b8e30d0f6302cf1f5d2aa7..3fd7f7aa8f7b02a066b0ffff57162fc328abce93 100644 (file)
@@ -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);
     }
 
index f430a2edad6aab7b8c2e70fc4c22311d67529e76..12083e23620614aa6cc61840bcbcd5de55b55b60 100644 (file)
@@ -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);
     }