2008-05-14 Dan Williams <dcbw@redhat.com>

* src/NetworkManagerSystem.c
		- (nm_system_device_is_up_with_iface): clean up



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3668 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams 2008-05-14 13:59:12 +00:00
parent 493f808b01
commit 2a2b75cc8b
2 changed files with 16 additions and 11 deletions

View file

@ -1,3 +1,8 @@
2008-05-14 Dan Williams <dcbw@redhat.com>
* src/NetworkManagerSystem.c
- (nm_system_device_is_up_with_iface): clean up
2008-05-13 Dan Williams <dcbw@redhat.com>
Fix refcounting issues over sleep/wake when a VPN connection was active that

View file

@ -470,7 +470,8 @@ gboolean
nm_system_device_is_up_with_iface (const char *iface)
{
struct ifreq ifr;
int err, fd;
int fd;
gboolean up = FALSE;
fd = socket (PF_INET, SOCK_DGRAM, 0);
if (fd < 0) {
@ -480,18 +481,17 @@ nm_system_device_is_up_with_iface (const char *iface)
/* Get device's flags */
strncpy (ifr.ifr_name, iface, IFNAMSIZ);
err = ioctl (fd, SIOCGIFFLAGS, &ifr);
if (ioctl (fd, SIOCGIFFLAGS, &ifr) < 0) {
if (errno != ENODEV) {
nm_warning ("%s: could not get flags for device %s. errno = %d",
__func__, iface, errno);
}
} else {
up = !!(ifr.ifr_flags & IFF_UP);
}
close (fd);
if (!err)
return (!((ifr.ifr_flags^IFF_UP) & IFF_UP));
if (errno != ENODEV) {
nm_warning ("%s: could not get flags for device %s. errno = %d",
__func__, iface, errno);
}
return FALSE;
return up;
}
gboolean