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
This commit is contained in:
Jiří Klimeš 2014-06-06 18:22:06 +02:00
parent ab1a015579
commit 3ef79ee249

View file

@ -305,13 +305,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);
g_object_set (s_bridge, option->name, value, NULL);
/* See comments in set_sysfs_uint() about centiseconds. */
if (option->user_hz_compensate)
value /= 100;
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);
}
}
}