From db81083ac2d8feb84d08e1c16ef285243fee7977 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Fri, 6 Jun 2014 18:22:06 +0200
Subject: [PATCH 1/1] device: don't call strtol() for NULL strings
#1 0x0000003c47239ea2 in __GI_strtol (nptr=nptr@entry=0x0, endptr=endptr@entry=0x0, base=base@entry=10) at ../stdlib/strtol.c:110
#2 0x000000000043b896 in update_connection (device=<optimized out>, connection=<optimized out>) at devices/nm-device-bridge.c:308
#3 0x000000000042ed2f in nm_device_generate_connection (device=device@entry=0xfbb260 [NMDeviceBridge]) at devices/nm-device.c:1644
#4 0x0000000000481613 in get_existing_connection (device=0xfbb260 [NMDeviceBridge], manager=0xfb2000 [NMManager]) at nm-manager.c:1549
#5 add_device (self=self@entry=0xfb2000 [NMManager], device=device@entry=0xfbb260 [NMDeviceBridge], generate_con=<optimized out>)
at nm-manager.c:1688
#6 0x0000000000481f50 in platform_link_added (plink=0x7fffffffdd50, ifindex=695, self=0xfb2000 [NMManager], reason=<optimized out>)
at nm-manager.c:2023
#7 platform_link_cb (platform=<optimized out>, ifindex=695, plink=0x7fffffffdd50, change_type=<optimized out>, reason=<optimized out>,
user_data=<optimized out>) at nm-manager.c:2038
(cherry picked from commit 3ef79ee2492475b213bcdf070a1f7207d4e58b64)
---
src/devices/nm-device-bridge.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/devices/nm-device-bridge.c b/src/devices/nm-device-bridge.c
index 92cc9f2..2e6a393 100644
--- a/src/devices/nm-device-bridge.c
+++ b/src/devices/nm-device-bridge.c
@@ -300,13 +300,20 @@ update_connection (NMDevice *device, NMConnection *connection)
for (option = master_options; option->name; option++) {
gs_free char *str = nm_platform_master_get_option (ifindex, option->sysname);
- int value = strtol (str, NULL, 10);
+ int value;
- /* See comments in set_sysfs_uint() about centiseconds. */
- if (option->user_hz_compensate)
- value /= 100;
+ if (str) {
+ value = strtol (str, NULL, 10);
+
+ /* See comments in set_sysfs_uint() about centiseconds. */
+ if (option->user_hz_compensate)
+ value /= 100;
- g_object_set (s_bridge, option->name, value, NULL);
+ g_object_set (s_bridge, option->name, value, NULL);
+ } else {
+ nm_log_warn (LOGD_BRIDGE, "(%s): failed to read bridge setting '%s'",
+ nm_device_get_iface (device), option->sysname);
+ }
}
}
--
1.9.3