ifcfg-rh: fix wireless_connection_from_ifcfg() to accept missing @error argument

wireless_connection_from_ifcfg() did not support being called without
error argument.

    #0  0x00007fe4fa2204e9 in g_logv (log_domain=0x7fe4f0597060 "NetworkManager-ifcfg-rh", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fff1c7aaf00) at gmessages.c:989
    #1  0x00007fe4fa22063f in g_log (log_domain=<optimized out>, log_level=<optimized out>, format=<optimized out>) at gmessages.c:1025
    #2  0x00007fe4f057eec3 in wireless_connection_from_ifcfg (file=0x7fe4fec7c800 "/etc/sysconfig/network-scripts/ifcfg-Wi-Fi-1", ifcfg=0x7fe4fec6f730, error=0x0) at reader.c:3431
    #3  0x00007fe4f057e2b6 in connection_from_file_full (filename=0x7fe4fec7c800 "/etc/sysconfig/network-scripts/ifcfg-Wi-Fi-1", network_file=0x7fe4f05976aa "/etc/sysconfig/network", test_type=0x0, out_unhandled=0x7fff1c7ab1f8,
        error=0x0, out_ignore_error=0x7fff1c7ab174) at reader.c:4750
    #4  0x00007fe4f057db80 in connection_from_file (filename=0x7fe4fec7c800 "/etc/sysconfig/network-scripts/ifcfg-Wi-Fi-1", out_unhandled=0x7fff1c7ab1f8, error=0x0) at reader.c:4834
    #5  0x00007fe4f057b4a6 in nm_ifcfg_connection_new (source=0x0, full_path=0x7fe4fec7c800 "/etc/sysconfig/network-scripts/ifcfg-Wi-Fi-1", error=0x0) at nm-ifcfg-connection.c:119
    #6  0x00007fe4f0579c1d in _internal_new_connection (self=0x7fe4fec6cd00, path=0x7fe4fec7c800 "/etc/sysconfig/network-scripts/ifcfg-Wi-Fi-1", source=0x0, error=0x0) at plugin.c:136
    #7  0x00007fe4f0579256 in connection_new_or_changed (self=0x7fe4fec6cd00, path=0x7fe4fec7c800 "/etc/sysconfig/network-scripts/ifcfg-Wi-Fi-1", existing=0x0, out_old_path=0x7fff1c7ab458) at plugin.c:265
    #8  0x00007fe4f0578f61 in read_connections (plugin=0x7fe4fec6cd00) at plugin.c:462
    #9  0x00007fe4f0578839 in get_connections (config=0x7fe4fec6cd00) at plugin.c:497
    #10 0x00007fe4fdc9affb in nm_system_config_interface_get_connections (config=0x7fe4fec6cd00) at settings/nm-system-config-interface.c:143
    #11 0x00007fe4fdc9764f in load_connections (self=0x7fe4fec6ca40) at settings/nm-settings.c:201
    #12 0x00007fe4fdc96d74 in nm_settings_new (error=0x7fff1c7abb18) at settings/nm-settings.c:1802
    #13 0x00007fe4fdc37146 in main (argc=1, argv=0x7fff1c7abcd8) at main.c:415

Fixes: 356849f70c
Fixes: 12bfaf5a8d
(cherry picked from commit ffe0fde235)
This commit is contained in:
Thomas Haller 2014-12-30 21:43:10 +01:00 committed by Dan Winship
parent f5c2665b62
commit 33eda353f7

View file

@ -3178,6 +3178,8 @@ make_wireless_security_setting (shvarFile *ifcfg,
{
NMSetting *wsec;
g_return_val_if_fail (error && !*error, NULL);
if (!adhoc) {
wsec = make_leap_setting (ifcfg, file, error);
if (wsec)
@ -3429,11 +3431,11 @@ wireless_connection_from_ifcfg (const char *file,
char *printable_ssid = NULL;
const char *mode;
gboolean adhoc = FALSE;
GError *local = NULL;
g_return_val_if_fail (file != NULL, NULL);
g_return_val_if_fail (ifcfg != NULL, NULL);
g_return_val_if_fail (error != NULL, NULL);
g_return_val_if_fail (*error == NULL, NULL);
g_return_val_if_fail (!error || !*error, NULL);
connection = nm_simple_connection_new ();
@ -3457,10 +3459,11 @@ wireless_connection_from_ifcfg (const char *file,
adhoc = TRUE;
/* Wireless security */
security_setting = make_wireless_security_setting (ifcfg, file, ssid, adhoc, &s_8021x, error);
if (*error) {
security_setting = make_wireless_security_setting (ifcfg, file, ssid, adhoc, &s_8021x, &local);
if (local) {
g_free (printable_ssid);
g_object_unref (connection);
g_propagate_error (error, local);
return NULL;
}
if (security_setting) {