NetworkManager r3959 - trunk/src
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: NetworkManager r3959 - trunk/src
- Date: Thu, 14 Aug 2008 16:52:06 +0000 (UTC)
Author: dcbw
Date: Thu Aug 14 16:52:06 2008
New Revision: 3959
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3959&view=rev
Log:
2008-08-14 Dan Williams <dcbw redhat com>
* src/NetworkManagerSystem.c
- (nm_system_device_is_up_with_iface): ensure ifreq is cleared before using
- (nm_system_device_set_up_down_with_iface): cleanups; only return
success if the operation really was successful
Modified:
trunk/src/NetworkManagerSystem.c
Modified: trunk/src/NetworkManagerSystem.c
==============================================================================
--- trunk/src/NetworkManagerSystem.c (original)
+++ trunk/src/NetworkManagerSystem.c Thu Aug 14 16:52:06 2008
@@ -428,10 +428,10 @@
gboolean nm_system_device_set_up_down_with_iface (const char *iface, gboolean up)
{
+ struct rtnl_link *request = NULL, *old = NULL;
+ struct nl_handle *nlh;
gboolean success = FALSE;
guint32 idx;
- struct rtnl_link * request = NULL;
- struct rtnl_link * old = NULL;
g_return_val_if_fail (iface != NULL, FALSE);
@@ -446,16 +446,13 @@
idx = nm_netlink_iface_to_index (iface);
old = nm_netlink_index_to_rtnl_link (idx);
if (old) {
- struct nl_handle *nlh;
-
nlh = nm_netlink_get_default_handle ();
if (nlh)
- rtnl_link_change (nlh, old, request, 0);
+ success = (rtnl_link_change (nlh, old, request, 0) == 0) ? TRUE : FALSE;
}
rtnl_link_put (old);
rtnl_link_put (request);
- success = TRUE;
out:
return success;
@@ -483,6 +480,7 @@
}
/* Get device's flags */
+ memset (&ifr, 0, sizeof (ifr));
strncpy (ifr.ifr_name, iface, IFNAMSIZ);
if (ioctl (fd, SIOCGIFFLAGS, &ifr) < 0) {
if (errno != ENODEV) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]