team: replace NL chars in team config when passing to libteamdctl (rh #1051517)

usock interface in libteamdctl uses \n as a parameter separator and thus would
cut the config. So we replace '\r' and '\n' with ' '.

https://bugzilla.redhat.com/show_bug.cgi?id=1051517
This commit is contained in:
Jiří Klimeš
2014-03-05 12:43:14 +01:00
parent 2b2f8e907e
commit cf5e759978

View File

@@ -679,8 +679,11 @@ enslave_slave (NMDevice *device,
iface, slave_iface);
} else {
int err;
char *sanitized_config;
err = teamdctl_port_config_update_raw (priv->tdc, slave_iface, config);
sanitized_config = g_strdelimit (g_strdup (config), "\r\n", ' ');
err = teamdctl_port_config_update_raw (priv->tdc, slave_iface, sanitized_config);
g_free (sanitized_config);
if (err != 0) {
nm_log_err (LOGD_TEAM, "(%s): failed to update config for port %s (err=%d)",
iface, slave_iface, err);