[NetworkManager-openvpn] properties: fix string comparison in hash_copy_advanced() wrongly using NM_IN_SET()



commit ba6c4bf1b827a1164032e0bf3cef0a72b79b66ae
Author: Thomas Haller <thaller redhat com>
Date:   Fri Oct 23 15:21:57 2020 +0200

    properties: fix string comparison in hash_copy_advanced() wrongly using NM_IN_SET()
    
          CC       properties/libnm_vpn_plugin_openvpn_editor_la-nm-openvpn-editor.lo
        properties/nm-openvpn-editor.c:2508:6: warning: result of comparison against a string literal is 
unspecified (use an explicit string comparison function instead) [-Wstring-compare]
                if (NM_IN_SET (key, NM_OPENVPN_KEY_HTTP_PROXY_PASSWORD))
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        ./shared/nm-utils/nm-macros-internal.h:531:45: note: expanded from macro 'NM_IN_SET'
        #define NM_IN_SET(x, ...)                   _NM_IN_SET(||, typeof (x), x, __VA_ARGS__)
                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        ./shared/nm-utils/nm-macros-internal.h:526:45: note: expanded from macro '_NM_IN_SET'
        #define _NM_IN_SET(op, type, x, ...)        _NM_IN_SET_EVAL_N(op, type, x, NM_NARG (__VA_ARGS__), 
__VA_ARGS__)
                                                    
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        ./shared/nm-utils/nm-macros-internal.h:523:11: note: expanded from macro '_NM_IN_SET_EVAL_N'
                !!_NM_IN_SET_EVAL_N2(op, _x, n, __VA_ARGS__);               \
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        ./shared/nm-utils/nm-macros-internal.h:515:50: note: expanded from macro '_NM_IN_SET_EVAL_N2'
        #define _NM_IN_SET_EVAL_N2(op, _x, n, ...)      (_NM_IN_SET_EVAL_##n(op, _x, __VA_ARGS__))
                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        <scratch space>:54:1: note: expanded from here
        _NM_IN_SET_EVAL_1
        ^
        ./shared/nm-utils/nm-macros-internal.h:498:53: note: expanded from macro '_NM_IN_SET_EVAL_1'
        #define _NM_IN_SET_EVAL_1( op, _x, y)           (_x == (y))
                                                            ^  ~~~

 properties/nm-openvpn-editor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/properties/nm-openvpn-editor.c b/properties/nm-openvpn-editor.c
index c89ba8f..2d0f204 100644
--- a/properties/nm-openvpn-editor.c
+++ b/properties/nm-openvpn-editor.c
@@ -2505,7 +2505,7 @@ hash_copy_advanced (gpointer key, gpointer data, gpointer user_data)
        g_return_if_fail (value && *value);
 
        /* HTTP Proxy password is a secret, not a data item */
-       if (NM_IN_SET (key, NM_OPENVPN_KEY_HTTP_PROXY_PASSWORD))
+       if (nm_streq0 (key, NM_OPENVPN_KEY_HTTP_PROXY_PASSWORD))
                nm_setting_vpn_add_secret (s_vpn, (const char *) key, value);
        else
                nm_setting_vpn_add_data_item (s_vpn, (const char *) key, value);


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