Commit 8200b37f authored by Dan Williams's avatar Dan Williams
Browse files

2004-10-28 Dan Williams <dcbw@redhat.com>

	* src/NetworkManagerUtils.c
		- (nm_spawn_process): Fix a potential dereference of NULL

	Patches from Peter Jones:

	* src/NetworkManagerDevice.c
		- (nm_device_test_wireless_extensions): Better check for
			wireless devices

	* src/NetworkManagerUtils.c
		- (nm_spawn_process): Pass in valid stdout and stderr so
			executed programs don't randomly SIGPIPE and fail
		- (nm_get_wired_driver_support_level): quash hal warning
			when checking for USB ethernet device


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@276 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent 6000e6f0
2004-10-28 Dan Williams <dcbw@redhat.com>
* src/NetworkManagerUtils.c
- (nm_spawn_process): Fix a potential dereference of NULL
Patches from Peter Jones:
* src/NetworkManagerDevice.c
- (nm_device_test_wireless_extensions): Better check for
wireless devices
* src/NetworkManagerUtils.c
- (nm_spawn_process): Pass in valid stdout and stderr so
executed programs don't randomly SIGPIPE and fail
- (nm_get_wired_driver_support_level): quash hal warning
when checking for USB ethernet device
2004-10-27 Dan Williams <dcbw@redhat.com>
* info-daemon/NetworkManagerInfo.c
......
......@@ -134,9 +134,9 @@ struct NMDevice
*/
static gboolean nm_device_test_wireless_extensions (NMDevice *dev)
{
int iwlib_socket;
int sk;
int error;
iwstats stats;
char ioctl_buf[64];
g_return_val_if_fail (dev != NULL, FALSE);
......@@ -146,9 +146,12 @@ static gboolean nm_device_test_wireless_extensions (NMDevice *dev)
if (dev->test_device)
return (FALSE);
iwlib_socket = iw_sockets_open ();
error = iw_get_stats (iwlib_socket, nm_device_get_iface (dev), &stats, NULL, FALSE);
close (iwlib_socket);
ioctl_buf[63] = 0;
strncpy(ioctl_buf, nm_device_get_iface(dev), 63);
sk = iw_sockets_open ();
error = ioctl(sk, SIOCGIWNAME, ioctl_buf);
close (sk);
return (error == 0);
}
......@@ -161,7 +164,7 @@ static gboolean nm_device_test_wireless_extensions (NMDevice *dev)
*/
static gboolean nm_device_supports_wireless_scan (NMDevice *dev)
{
int iwlib_socket;
int sk;
int error;
gboolean can_scan = TRUE;
wireless_scan_head scan_data;
......@@ -173,12 +176,12 @@ static gboolean nm_device_supports_wireless_scan (NMDevice *dev)
if (dev->test_device)
return (TRUE);
iwlib_socket = iw_sockets_open ();
error = iw_scan (iwlib_socket, (char *)nm_device_get_iface (dev), WIRELESS_EXT, &scan_data);
sk = iw_sockets_open ();
error = iw_scan (sk, (char *)nm_device_get_iface (dev), WIRELESS_EXT, &scan_data);
nm_dispose_scan_results (scan_data.result);
if ((error == -1) && (errno == EOPNOTSUPP))
can_scan = FALSE;
close (iwlib_socket);
close (sk);
return (can_scan);
}
......
......@@ -184,30 +184,30 @@ void nm_dispose_scan_results (wireless_scan *result_list)
int nm_spawn_process (char *args)
{
gint num_args;
char **argv;
int exit_status;
char **argv = NULL;
int exit_status = -1;
GError *error = NULL;
char *so = NULL;
char *se = NULL;
g_return_val_if_fail (args != NULL, -1);
if (g_shell_parse_argv (args, &num_args, &argv, NULL))
if (g_shell_parse_argv (args, &num_args, &argv, &error))
{
if (g_spawn_sync ("/", argv, NULL, 0, NULL, NULL, NULL, NULL, &exit_status, &error))
{
g_strfreev (argv);
return (exit_status);
}
else
syslog (LOG_ERR, "nm_spawn_process('%s'): could not spawn process. (%s)\n", args, error->message);
GError *error2 = NULL;
g_strfreev (argv);
if (error)
g_error_free (error);
}
else
syslog (LOG_ERR, "nm_spawn_process('%s'): could not parse arguments (%s)\n", args, error->message);
if (!g_spawn_sync ("/", argv, NULL, 0, NULL, NULL, &so, &se, &exit_status, &error2))
syslog (LOG_ERR, "nm_spawn_process('%s'): could not spawn process. (%s)\n", args, error2->message);
return (-1);
if (so) g_free(so);
if (se) g_free(se);
if (argv) g_strfreev (argv);
if (error2) g_error_free (error2);
} else syslog (LOG_ERR, "nm_spawn_process('%s'): could not parse arguments (%s)\n", args, error->message);
if (error) g_error_free (error);
return (exit_status);
}
......@@ -422,6 +422,7 @@ NMDriverSupportLevel nm_get_wired_driver_support_level (LibHalContext *ctx, NMDe
NMDriverSupportLevel level = NM_DRIVER_FULLY_SUPPORTED;
char *driver_name = NULL;
char *usb_test;
char *udi;
g_return_val_if_fail (ctx != NULL, FALSE);
g_return_val_if_fail (dev != NULL, FALSE);
......@@ -446,7 +447,9 @@ NMDriverSupportLevel nm_get_wired_driver_support_level (LibHalContext *ctx, NMDe
level = NM_DRIVER_UNSUPPORTED;
/* Ignore Ethernet-over-USB devices too for the moment (Red Hat #135722) */
if ((usb_test = hal_device_get_property_string (ctx, nm_device_get_udi (dev), "usb.interface.class")))
udi = nm_device_get_udi (dev);
if ( hal_device_property_exists (ctx, udi, "usb.interface.class")
&& (usb_test = hal_device_get_property_string (ctx, udi, "usb.interface.class")))
{
hal_free_string (usb_test);
level = NM_DRIVER_UNSUPPORTED;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment