diff options
author | Thomas Haller <thaller@redhat.com> | 2014-03-12 13:01:37 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-04-10 16:32:08 +0200 |
commit | bd08198064abc2152f484d9d1557f687f28e308e (patch) | |
tree | 7caf1e5dba59ab0d45a89193c7027ac7f9aab708 | |
parent | 8794d80509a9e49ed917725f1ca42a808da33310 (diff) |
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 <thaller@redhat.com>
-rw-r--r-- | src/devices/nm-device-infiniband.c | 9 |
1 files 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 |