[PATCH] virt-aa-helper: fix clang build

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

 



Clang complains about wrong argument type:

libvirt/src/security/virt-aa-helper.c:174:11: error: absolute value
      function 'abs' given an argument of type 'long' but has parameter
      of type 'int' which may cause truncation of value [-Werror,-Wabsolute-value]
    idx = abs(pos - orig);
          ^

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/security/virt-aa-helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 7eeb4ef..14f8afb 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -171,7 +171,7 @@ replace_string(char *orig, const size_t len, const char *oldstr,
     }
     tmp[0] = '\0';
 
-    idx = abs(pos - orig);
+    idx = abs((int)(pos - orig));
 
     /* copy everything up to oldstr */
     strncat(tmp, orig, idx);
-- 
2.8.2

--
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]