From bd08198064abc2152f484d9d1557f687f28e308e Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 12 Mar 2014 13:01:37 +0100 Subject: core: use nm_platform_sysctl_get() to read infiniband mode nm_platform_sysctl_get() adds logging and is our prefered way to read sysfs. Signed-off-by: Thomas Haller --- src/devices/nm-device-infiniband.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/devices/nm-device-infiniband.c b/src/devices/nm-device-infiniband.c index 1bc3d5edfc..af91433511 100644 --- a/src/devices/nm-device-infiniband.c +++ b/src/devices/nm-device-infiniband.c @@ -313,7 +313,7 @@ update_connection (NMDevice *device, NMConnection *connection) gconstpointer mac = nm_device_get_hw_address (device, &maclen); static const guint8 null_mac[INFINIBAND_ALEN] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; GByteArray *array; - char *mode_path, *contents; + char *mode_path, *contents = NULL; const char *transport_mode = "datagram"; if (!s_infiniband) { @@ -330,15 +330,16 @@ update_connection (NMDevice *device, NMConnection *connection) mode_path = g_strdup_printf ("/sys/class/net/%s/mode", ASSERT_VALID_PATH_COMPONENT (nm_device_get_iface (device))); - if (g_file_get_contents (mode_path, &contents, NULL, NULL)) { + contents = nm_platform_sysctl_get (mode_path); + g_free (mode_path); + if (contents) { if (strstr (contents, "datagram")) transport_mode = "datagram"; else if (strstr (contents, "connected")) transport_mode = "connected"; + g_free (contents); } g_object_set (G_OBJECT (s_infiniband), NM_SETTING_INFINIBAND_TRANSPORT_MODE, transport_mode, NULL); - g_free (mode_path); - g_free (contents); } static gboolean -- cgit v1.2.3