mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-06 12:50:33 +01:00
all: merge branch 'th/bgo733806_clang'
Fix sources so that they compile with clang.
https://bugzilla.gnome.org/show_bug.cgi?id=733806
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit b456900531)
This commit is contained in:
commit
5fe7d375a6
28 changed files with 129 additions and 72 deletions
|
|
@ -2203,17 +2203,6 @@ static const NameItem nmc_cdma_settings [] = {
|
|||
{ NULL, NULL, NULL, FALSE }
|
||||
};
|
||||
|
||||
static const NameItem nmc_mobile_settings [] = {
|
||||
{ NM_SETTING_CONNECTION_SETTING_NAME, NULL, NULL, TRUE },
|
||||
{ NM_SETTING_SERIAL_SETTING_NAME, NULL, NULL, FALSE },
|
||||
{ NM_SETTING_PPP_SETTING_NAME, NULL, NULL, FALSE },
|
||||
{ NM_SETTING_GSM_SETTING_NAME, NULL, NULL, TRUE },
|
||||
{ NM_SETTING_CDMA_SETTING_NAME, NULL, NULL, TRUE },
|
||||
{ NM_SETTING_IP4_CONFIG_SETTING_NAME, NULL, NULL, FALSE },
|
||||
{ NM_SETTING_IP6_CONFIG_SETTING_NAME, NULL, NULL, FALSE },
|
||||
{ NULL, NULL, NULL, FALSE }
|
||||
};
|
||||
|
||||
static const NameItem nmc_bluetooth_settings [] = {
|
||||
{ NM_SETTING_CONNECTION_SETTING_NAME, NULL, NULL, TRUE },
|
||||
{ NM_SETTING_BLUETOOTH_SETTING_NAME, NULL, NULL, TRUE },
|
||||
|
|
@ -2529,6 +2518,9 @@ check_and_convert_mtu (const char *mtu, guint32 *mtu_int, GError **error)
|
|||
{
|
||||
unsigned long local_mtu_int;
|
||||
|
||||
if (mtu_int)
|
||||
*mtu_int = 0;
|
||||
|
||||
if (!mtu)
|
||||
return TRUE;
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "utils.h"
|
||||
#include "common.h"
|
||||
#include "settings.h"
|
||||
#include "nm-glib-compat.h"
|
||||
|
||||
/* Forward declarations */
|
||||
static char *wep_key_type_to_string (NMWepKeyType type);
|
||||
|
|
|
|||
|
|
@ -700,9 +700,9 @@ parse_output_fields (const char *fields_str,
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
break;
|
||||
}
|
||||
if (found)
|
||||
break;
|
||||
}
|
||||
if (found) {
|
||||
/* Add index to array, and field name (or NULL) to group_fields array */
|
||||
|
|
|
|||
|
|
@ -27,8 +27,25 @@
|
|||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
|
||||
#ifdef __clang__
|
||||
|
||||
#undef G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
#undef G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
|
||||
_Pragma("clang diagnostic push") \
|
||||
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
|
||||
|
||||
#define G_GNUC_END_IGNORE_DEPRECATIONS \
|
||||
_Pragma("clang diagnostic pop")
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#include "nm-gvaluearray-compat.h"
|
||||
|
||||
|
||||
#if !GLIB_CHECK_VERSION(2,34,0)
|
||||
static inline void
|
||||
g_type_ensure (GType type)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
#include <glib.h>
|
||||
|
||||
#include "nm-glib-compat.h"
|
||||
|
||||
#define g_value_array_get_type() \
|
||||
G_GNUC_EXTENSION ({ \
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
|
||||
|
|
|
|||
|
|
@ -70,13 +70,13 @@ typedef struct RemoteCall RemoteCall;
|
|||
typedef void (*RemoteCallFetchResultCb) (RemoteCall *call, DBusGProxyCall *proxy_call, GError *error);
|
||||
|
||||
|
||||
typedef struct RemoteCall {
|
||||
struct RemoteCall {
|
||||
NMRemoteConnection *self;
|
||||
DBusGProxyCall *call;
|
||||
RemoteCallFetchResultCb fetch_result_cb;
|
||||
GFunc callback;
|
||||
gpointer user_data;
|
||||
} RemoteCall;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
DBusGConnection *bus;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ cleanup (void)
|
|||
|
||||
#define test_assert(condition) \
|
||||
do { \
|
||||
gboolean _condition = ( condition ); \
|
||||
gboolean _condition = !!( condition ); \
|
||||
\
|
||||
if (G_UNLIKELY (!_condition)) { \
|
||||
cleanup (); \
|
||||
|
|
@ -70,6 +70,7 @@ add_cb (NMRemoteSettings *s,
|
|||
|
||||
*((gboolean *) user_data) = TRUE;
|
||||
remote = connection;
|
||||
g_object_add_weak_pointer (G_OBJECT (connection), (void **) &remote);
|
||||
}
|
||||
|
||||
#define TEST_CON_ID "blahblahblah"
|
||||
|
|
@ -186,6 +187,9 @@ test_make_invisible (void)
|
|||
} while ((done == FALSE) && (now - start < 5));
|
||||
test_assert (done == TRUE);
|
||||
|
||||
g_assert (remote);
|
||||
g_signal_handlers_disconnect_by_func (remote, G_CALLBACK (invis_removed_cb), &done);
|
||||
|
||||
/* Ensure NMRemoteSettings no longer has the connection */
|
||||
list = nm_remote_settings_list_connections (settings);
|
||||
for (iter = list; iter; iter = g_slist_next (iter)) {
|
||||
|
|
@ -196,6 +200,7 @@ test_make_invisible (void)
|
|||
}
|
||||
|
||||
/* And ensure the invisible connection no longer has any settings */
|
||||
g_assert (remote);
|
||||
nm_connection_for_each_setting_value (NM_CONNECTION (remote),
|
||||
invis_has_settings_cb,
|
||||
&has_settings);
|
||||
|
|
@ -251,8 +256,11 @@ test_make_visible (void)
|
|||
} while ((new == NULL) && (now - start < 5));
|
||||
|
||||
/* Ensure the new connection is the same as the one we made visible again */
|
||||
test_assert (new);
|
||||
test_assert (new == remote);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (settings, G_CALLBACK (vis_new_connection_cb), &new);
|
||||
|
||||
/* Ensure NMRemoteSettings has the connection */
|
||||
list = nm_remote_settings_list_connections (settings);
|
||||
for (iter = list; iter; iter = g_slist_next (iter)) {
|
||||
|
|
@ -309,6 +317,8 @@ test_remove_connection (void)
|
|||
test_assert (g_slist_length (list) > 0);
|
||||
|
||||
connection = NM_REMOTE_CONNECTION (list->data);
|
||||
g_assert (connection);
|
||||
g_assert (remote == connection);
|
||||
path = g_strdup (nm_connection_get_path (NM_CONNECTION (connection)));
|
||||
g_signal_connect (connection, "removed", G_CALLBACK (removed_cb), &done);
|
||||
|
||||
|
|
@ -328,6 +338,8 @@ test_remove_connection (void)
|
|||
} while ((done == FALSE) && (now - start < 5));
|
||||
test_assert (done == TRUE);
|
||||
|
||||
g_assert (!remote);
|
||||
|
||||
/* Ensure NMRemoteSettings no longer has the connection */
|
||||
list = nm_remote_settings_list_connections (settings);
|
||||
for (iter = list; iter; iter = g_slist_next (iter)) {
|
||||
|
|
|
|||
|
|
@ -92,6 +92,11 @@ NM_SETTING_REGISTER_TYPE (NM_TYPE_SETTING_802_1X)
|
|||
|
||||
#define NM_SETTING_802_1X_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_802_1X, NMSetting8021xPrivate))
|
||||
|
||||
G_STATIC_ASSERT ( (NM_SETTING_802_1X_CK_FORMAT_UNKNOWN == (NMSetting8021xCKFormat) NM_CRYPTO_FILE_FORMAT_UNKNOWN) );
|
||||
G_STATIC_ASSERT ( (NM_SETTING_802_1X_CK_FORMAT_X509 == (NMSetting8021xCKFormat) NM_CRYPTO_FILE_FORMAT_X509) );
|
||||
G_STATIC_ASSERT ( (NM_SETTING_802_1X_CK_FORMAT_RAW_KEY == (NMSetting8021xCKFormat) NM_CRYPTO_FILE_FORMAT_RAW_KEY) );
|
||||
G_STATIC_ASSERT ( (NM_SETTING_802_1X_CK_FORMAT_PKCS12 == (NMSetting8021xCKFormat) NM_CRYPTO_FILE_FORMAT_PKCS12) );
|
||||
|
||||
typedef struct {
|
||||
GSList *eap; /* GSList of strings */
|
||||
char *identity;
|
||||
|
|
@ -1824,7 +1829,7 @@ nm_setting_802_1x_set_private_key (NMSetting8021x *setting,
|
|||
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD);
|
||||
|
||||
if (out_format)
|
||||
*out_format = format;
|
||||
*out_format = (NMSetting8021xCKFormat) format;
|
||||
return priv->private_key != NULL;
|
||||
}
|
||||
|
||||
|
|
@ -2135,7 +2140,7 @@ nm_setting_802_1x_set_phase2_private_key (NMSetting8021x *setting,
|
|||
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD);
|
||||
|
||||
if (out_format)
|
||||
*out_format = format;
|
||||
*out_format = (NMSetting8021xCKFormat) format;
|
||||
return priv->phase2_private_key != NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ static void
|
|||
_string_array_to_string (const GPtrArray *strings, GValue *dest_value)
|
||||
{
|
||||
GString *printable;
|
||||
int i;
|
||||
guint i;
|
||||
|
||||
printable = g_string_new (NULL);
|
||||
for (i = 0; strings && i < strings->len; i++) {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,23 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
|
|||
AC_MSG_RESULT(yes)
|
||||
CFLAGS="-Wall -std=gnu89 $CFLAGS"
|
||||
|
||||
dnl clang only warns about unknown warnings, unless
|
||||
dnl called with "-Werror=unknown-warning-option"
|
||||
dnl Test if the compiler supports that, and if it does
|
||||
dnl attach it to the CFLAGS.
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
EXTRA_CFLAGS="-Werror=unknown-warning-option"
|
||||
CFLAGS="$SAVE_CFLAGS $EXTRA_CFLAGS"
|
||||
AC_TRY_COMPILE([], [],
|
||||
has_option=yes,
|
||||
has_option=no,)
|
||||
if test $has_option = no; then
|
||||
EXTRA_CFLAGS=
|
||||
fi
|
||||
CFLAGS="$SAVE_CFLAGS"
|
||||
unset has_option
|
||||
unset SAVE_CFLAGS
|
||||
|
||||
for option in -Wshadow -Wmissing-declarations -Wmissing-prototypes \
|
||||
-Wdeclaration-after-statement -Wformat-security \
|
||||
-Wfloat-equal -Wno-unused-parameter -Wno-sign-compare \
|
||||
|
|
@ -15,19 +32,22 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
|
|||
-Wpointer-arith -Winit-self \
|
||||
-Wmissing-include-dirs -Waggregate-return; do
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $option"
|
||||
CFLAGS="$CFLAGS $EXTRA_CFLAGS $option"
|
||||
AC_MSG_CHECKING([whether gcc understands $option])
|
||||
AC_TRY_COMPILE([], [],
|
||||
has_option=yes,
|
||||
has_option=no,)
|
||||
if test $has_option = no; then
|
||||
CFLAGS="$SAVE_CFLAGS"
|
||||
else
|
||||
CFLAGS="$SAVE_CFLAGS $option"
|
||||
fi
|
||||
AC_MSG_RESULT($has_option)
|
||||
unset has_option
|
||||
unset SAVE_CFLAGS
|
||||
done
|
||||
unset option
|
||||
unset EXTRA_CFLAGS
|
||||
if test "x$set_more_warnings" = xerror; then
|
||||
CFLAGS="$CFLAGS -Werror"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1208,5 +1208,6 @@ fail:
|
|||
else
|
||||
nm_log_err (LOGD_CORE, "Failed asserting path component: \"%s\"", name);
|
||||
g_error ("FATAL: Failed asserting path component: %s", name ? name : "(null)");
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1234,7 +1234,7 @@ dcb_state (NMDevice *device, gboolean timeout)
|
|||
if (!dcb_enable (device)) {
|
||||
dcb_carrier_cleanup (device);
|
||||
nm_device_state_changed (device,
|
||||
NM_ACT_STAGE_RETURN_FAILURE,
|
||||
NM_DEVICE_STATE_FAILED,
|
||||
NM_DEVICE_STATE_REASON_DCB_FCOE_FAILED);
|
||||
}
|
||||
}
|
||||
|
|
@ -1258,7 +1258,7 @@ dcb_state (NMDevice *device, gboolean timeout)
|
|||
if (!dcb_configure (device)) {
|
||||
dcb_carrier_cleanup (device);
|
||||
nm_device_state_changed (device,
|
||||
NM_ACT_STAGE_RETURN_FAILURE,
|
||||
NM_DEVICE_STATE_FAILED,
|
||||
NM_DEVICE_STATE_REASON_DCB_FCOE_FAILED);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ static const char *state_table[] = {
|
|||
static const char *
|
||||
queued_state_to_string (NMDeviceState state)
|
||||
{
|
||||
if (state >= 0 && state < G_N_ELEMENTS (state_table))
|
||||
if ((gsize) state < G_N_ELEMENTS (state_table))
|
||||
return state_table[state];
|
||||
return state_table[NM_DEVICE_STATE_UNKNOWN];
|
||||
}
|
||||
|
|
@ -442,7 +442,7 @@ static const char *reason_table[] = {
|
|||
static const char *
|
||||
reason_to_string (NMDeviceStateReason reason)
|
||||
{
|
||||
if (reason >= 0 && reason < G_N_ELEMENTS (reason_table))
|
||||
if ((gsize) reason < G_N_ELEMENTS (reason_table))
|
||||
return reason_table[reason];
|
||||
return reason_table[NM_DEVICE_STATE_REASON_UNKNOWN];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason)
|
|||
/* FIXME: VPN stuff here is a bug; but we can't really change API now... */
|
||||
nm_device_state_changed (NM_DEVICE (priv->companion),
|
||||
NM_DEVICE_STATE_DISCONNECTED,
|
||||
NM_VPN_CONNECTION_STATE_REASON_USER_DISCONNECTED);
|
||||
NM_DEVICE_STATE_REASON_USER_REQUESTED);
|
||||
nm_log_info (LOGD_OLPC, "(%s): companion %s disconnected",
|
||||
nm_device_get_iface (dev),
|
||||
nm_device_get_iface (priv->companion));
|
||||
|
|
@ -315,7 +315,7 @@ companion_state_changed_cb (NMDeviceWifi *companion,
|
|||
/* FIXME: VPN stuff here is a bug; but we can't really change API now... */
|
||||
nm_device_state_changed (NM_DEVICE (self),
|
||||
NM_DEVICE_STATE_DISCONNECTED,
|
||||
NM_VPN_CONNECTION_STATE_REASON_USER_DISCONNECTED);
|
||||
NM_DEVICE_STATE_REASON_USER_REQUESTED);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ static const char *state_table[] = {
|
|||
const char *
|
||||
nm_modem_state_to_string (NMModemState state)
|
||||
{
|
||||
if (state >= 0 && state < G_N_ELEMENTS (state_table))
|
||||
if ((gsize) state < G_N_ELEMENTS (state_table))
|
||||
return state_table[state];
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -607,7 +607,7 @@ static const char *state_table[] = {
|
|||
static const char *
|
||||
state_to_string (NMDHCPState state)
|
||||
{
|
||||
if (state >= 0 && state < G_N_ELEMENTS (state_table))
|
||||
if ((gsize) state < G_N_ELEMENTS (state_table))
|
||||
return state_table[state];
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include <glib.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include "nm-utils.h"
|
||||
#include "nm-dns-manager.h"
|
||||
#include "nm-ip4-config.h"
|
||||
#include "nm-ip6-config.h"
|
||||
|
|
@ -130,12 +131,8 @@ merge_one_ip4_config (NMResolvConfData *rc, NMIP4Config *src)
|
|||
|
||||
num = nm_ip4_config_get_num_nameservers (src);
|
||||
for (i = 0; i < num; i++) {
|
||||
guint32 addr;
|
||||
char buf[INET_ADDRSTRLEN];
|
||||
|
||||
addr = nm_ip4_config_get_nameserver (src, i);
|
||||
if (inet_ntop (AF_INET, &addr, buf, INET_ADDRSTRLEN) > 0)
|
||||
add_string_item (rc->nameservers, buf);
|
||||
add_string_item (rc->nameservers,
|
||||
nm_utils_inet4_ntop (nm_ip4_config_get_nameserver (src, i), NULL));
|
||||
}
|
||||
|
||||
num = nm_ip4_config_get_num_domains (src);
|
||||
|
|
@ -161,12 +158,8 @@ merge_one_ip4_config (NMResolvConfData *rc, NMIP4Config *src)
|
|||
/* NIS stuff */
|
||||
num = nm_ip4_config_get_num_nis_servers (src);
|
||||
for (i = 0; i < num; i++) {
|
||||
guint32 addr;
|
||||
char buf[INET_ADDRSTRLEN];
|
||||
|
||||
addr = nm_ip4_config_get_nis_server (src, i);
|
||||
if (inet_ntop (AF_INET, &addr, buf, INET_ADDRSTRLEN) > 0)
|
||||
add_string_item (rc->nis_servers, buf);
|
||||
add_string_item (rc->nis_servers,
|
||||
nm_utils_inet4_ntop (nm_ip4_config_get_nis_server (src, i), NULL));
|
||||
}
|
||||
|
||||
if (nm_ip4_config_get_nis_domain (src)) {
|
||||
|
|
@ -187,25 +180,21 @@ merge_one_ip6_config (NMResolvConfData *rc, NMIP6Config *src)
|
|||
num = nm_ip6_config_get_num_nameservers (src);
|
||||
for (i = 0; i < num; i++) {
|
||||
const struct in6_addr *addr;
|
||||
char buf[INET6_ADDRSTRLEN];
|
||||
char *tmp;
|
||||
char buf[NM_UTILS_INET_ADDRSTRLEN + 50];
|
||||
|
||||
addr = nm_ip6_config_get_nameserver (src, i);
|
||||
|
||||
/* inet_ntop is probably supposed to do this for us, but it doesn't */
|
||||
if (IN6_IS_ADDR_V4MAPPED (addr)) {
|
||||
if (inet_ntop (AF_INET, &(addr->s6_addr32[3]), buf, INET_ADDRSTRLEN) > 0)
|
||||
add_string_item (rc->nameservers, buf);
|
||||
} else {
|
||||
if (inet_ntop (AF_INET6, addr, buf, INET6_ADDRSTRLEN) > 0) {
|
||||
if (iface && IN6_IS_ADDR_LINKLOCAL (addr)) {
|
||||
tmp = g_strdup_printf ("%s%%%s", buf, iface);
|
||||
add_string_item (rc->nameservers, tmp);
|
||||
g_free (tmp);
|
||||
} else
|
||||
add_string_item (rc->nameservers, buf);
|
||||
if (IN6_IS_ADDR_V4MAPPED (addr))
|
||||
nm_utils_inet4_ntop (addr->s6_addr32[3], buf);
|
||||
else {
|
||||
nm_utils_inet6_ntop (addr, buf);
|
||||
if (iface && IN6_IS_ADDR_LINKLOCAL (addr)) {
|
||||
g_strlcat (buf, "%", sizeof (buf));
|
||||
g_strlcat (buf, iface, sizeof (buf));
|
||||
}
|
||||
}
|
||||
add_string_item (rc->nameservers, buf);
|
||||
}
|
||||
|
||||
num = nm_ip6_config_get_num_domains (src);
|
||||
|
|
|
|||
|
|
@ -1723,15 +1723,14 @@ add_object (NMPlatform *platform, struct nl_object *obj)
|
|||
|
||||
/* Decreases the reference count if @obj for convenience */
|
||||
static gboolean
|
||||
delete_object (NMPlatform *platform, struct nl_object *obj, gboolean do_refresh_object)
|
||||
delete_object (NMPlatform *platform, struct nl_object *object, gboolean do_refresh_object)
|
||||
{
|
||||
NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform);
|
||||
auto_nl_object struct nl_object *obj_cleanup = obj;
|
||||
struct nl_object *object = obj;
|
||||
int object_type;
|
||||
int nle;
|
||||
gboolean result = FALSE;
|
||||
|
||||
object_type = object_type_from_nl_object (obj);
|
||||
object_type = object_type_from_nl_object (object);
|
||||
g_return_val_if_fail (object_type != OBJECT_TYPE_UNKNOWN, FALSE);
|
||||
|
||||
switch (object_type) {
|
||||
|
|
@ -1774,14 +1773,18 @@ delete_object (NMPlatform *platform, struct nl_object *obj, gboolean do_refresh_
|
|||
goto DEFAULT;
|
||||
DEFAULT:
|
||||
default:
|
||||
error ("Netlink error deleting %s: %s (%d)", to_string_object (platform, obj), nl_geterror (nle), nle);
|
||||
return FALSE;
|
||||
error ("Netlink error deleting %s: %s (%d)", to_string_object (platform, object), nl_geterror (nle), nle);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (do_refresh_object)
|
||||
refresh_object (platform, object, TRUE, NM_PLATFORM_REASON_INTERNAL);
|
||||
|
||||
return TRUE;
|
||||
result = TRUE;
|
||||
|
||||
out:
|
||||
nl_object_put (object);
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -532,6 +532,9 @@ parse_ip_address (int family, char *str, gpointer address, int *plen)
|
|||
{
|
||||
char *endptr;
|
||||
|
||||
if (plen)
|
||||
*plen = 0;
|
||||
|
||||
if (plen) {
|
||||
char *ptr = strchr (str, '/');
|
||||
if (ptr) {
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ software_add (NMLinkType link_type, const char *name)
|
|||
default:
|
||||
g_error ("Link type %d unhandled.", link_type);
|
||||
}
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -188,12 +189,12 @@ test_slave (int master, int type, SignalData *master_changed)
|
|||
/* Older team versions (e.g. Fedora 17) have a bug that team master stays
|
||||
* IFF_LOWER_UP even if its slave is down. Double check it with iproute2 and if
|
||||
* `ip link` also claims master to be up, accept it. */
|
||||
char *stdout = NULL;
|
||||
char *stdout_str = NULL;
|
||||
|
||||
nmtst_spawn_sync (NULL, &stdout, NULL, 0, "/sbin/ip", "link", "show", "dev", nm_platform_link_get_name (master));
|
||||
nmtst_spawn_sync (NULL, &stdout_str, NULL, 0, "/sbin/ip", "link", "show", "dev", nm_platform_link_get_name (master));
|
||||
|
||||
g_assert (strstr (stdout, "LOWER_UP"));
|
||||
g_free (stdout);
|
||||
g_assert (strstr (stdout_str, "LOWER_UP"));
|
||||
g_free (stdout_str);
|
||||
} else
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -679,11 +679,20 @@ static int nl80211_wiphy_info_handler (struct nl_msg *msg, void *arg)
|
|||
static struct nla_policy freq_policy[NL80211_FREQUENCY_ATTR_MAX + 1] = {
|
||||
[NL80211_FREQUENCY_ATTR_FREQ] = { .type = NLA_U32 },
|
||||
[NL80211_FREQUENCY_ATTR_DISABLED] = { .type = NLA_FLAG },
|
||||
#ifdef NL80211_FREQUENCY_ATTR_NO_IR
|
||||
[NL80211_FREQUENCY_ATTR_NO_IR] = { .type = NLA_FLAG },
|
||||
#else
|
||||
[NL80211_FREQUENCY_ATTR_PASSIVE_SCAN] = { .type = NLA_FLAG },
|
||||
[NL80211_FREQUENCY_ATTR_NO_IBSS] = { .type = NLA_FLAG },
|
||||
#endif
|
||||
[NL80211_FREQUENCY_ATTR_RADAR] = { .type = NLA_FLAG },
|
||||
[NL80211_FREQUENCY_ATTR_MAX_TX_POWER] = { .type = NLA_U32 },
|
||||
};
|
||||
#ifdef NL80211_FREQUENCY_ATTR_NO_IR
|
||||
G_STATIC_ASSERT (NL80211_FREQUENCY_ATTR_PASSIVE_SCAN == NL80211_FREQUENCY_ATTR_NO_IR && NL80211_FREQUENCY_ATTR_NO_IBSS == NL80211_FREQUENCY_ATTR_NO_IR);
|
||||
#else
|
||||
G_STATIC_ASSERT (NL80211_FREQUENCY_ATTR_PASSIVE_SCAN != NL80211_FREQUENCY_ATTR_NO_IBSS);
|
||||
#endif
|
||||
|
||||
if (nla_parse (tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
|
||||
genlmsg_attrlen (gnlh, 0), NULL) < 0)
|
||||
|
|
|
|||
|
|
@ -3266,7 +3266,7 @@ fill_8021x (shvarFile *ifcfg,
|
|||
char *lower = NULL;
|
||||
|
||||
lower = g_ascii_strdown (*iter, -1);
|
||||
while (eap->method && !found) {
|
||||
while (eap->method) {
|
||||
if (strcmp (eap->method, lower))
|
||||
goto next;
|
||||
|
||||
|
|
@ -3287,6 +3287,7 @@ fill_8021x (shvarFile *ifcfg,
|
|||
}
|
||||
nm_setting_802_1x_add_eap_method (s_8021x, lower);
|
||||
found = TRUE;
|
||||
break;
|
||||
|
||||
next:
|
||||
eap++;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
char *
|
||||
utils_single_quote_string (const char *str)
|
||||
{
|
||||
static const char const drop_chars[] = "\r\n"; /* drop CR and LF */
|
||||
static const char *drop_chars = "\r\n"; /* drop CR and LF */
|
||||
static const char escape_char = '\\'; /* escape char is backslash */
|
||||
static const char quote_char = '\''; /* quote char is single quote */
|
||||
size_t i, slen, j = 0;
|
||||
|
|
|
|||
|
|
@ -2502,7 +2502,6 @@ error:
|
|||
static char *
|
||||
escape_id (const char *id)
|
||||
{
|
||||
static const char const as_dash[] = "\\][|/=()!";
|
||||
char *escaped = g_strdup (id);
|
||||
char *p = escaped;
|
||||
|
||||
|
|
@ -2510,7 +2509,7 @@ escape_id (const char *id)
|
|||
while (*p) {
|
||||
if (*p == ' ')
|
||||
*p = '_';
|
||||
else if (strchr (as_dash, *p))
|
||||
else if (strchr ("\\][|/=()!", *p))
|
||||
*p = '-';
|
||||
p++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1383,7 +1383,7 @@ fill_8021x (const char *ssid,
|
|||
char *lower = NULL;
|
||||
|
||||
lower = g_ascii_strdown (*iter, -1);
|
||||
while (eap->method && !found) {
|
||||
while (eap->method) {
|
||||
if (strcmp (eap->method, lower))
|
||||
goto next;
|
||||
|
||||
|
|
@ -1404,6 +1404,7 @@ fill_8021x (const char *ssid,
|
|||
}
|
||||
nm_setting_802_1x_add_eap_method (s_8021x, lower);
|
||||
found = TRUE;
|
||||
break;
|
||||
|
||||
next:
|
||||
eap++;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ test_nm_utils_ascii_str_to_int64_do (const char *str, guint base, gint64 min,
|
|||
NULL,
|
||||
};
|
||||
const char **ws_pre, **ws_post, **null;
|
||||
int i;
|
||||
guint i;
|
||||
|
||||
if (str == NULL || exp_errno != 0) {
|
||||
test_nm_utils_ascii_str_to_int64_check (str, base, min, max, fallback, exp_errno, exp_val);
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ _state_to_nm_vpn_state (VpnState state)
|
|||
case STATE_FAILED:
|
||||
return NM_VPN_CONNECTION_STATE_FAILED;
|
||||
default:
|
||||
return STATE_UNKNOWN;
|
||||
return NM_VPN_CONNECTION_STATE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -662,7 +662,7 @@ static const char *state_table[] = {
|
|||
static const char *
|
||||
vpn_state_to_string (VpnState state)
|
||||
{
|
||||
if (state >= 0 && state < G_N_ELEMENTS (state_table))
|
||||
if ((gsize) state < G_N_ELEMENTS (state_table))
|
||||
return state_table[state];
|
||||
return "unknown";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#include "nm-glib-compat.h"
|
||||
#include "nmt-newt-utils.h"
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue