]> git.pld-linux.org Git - packages/icewm.git/blobdiff - icewm-ifstate-exact-check.patch
- from debian, description inside
[packages/icewm.git] / icewm-ifstate-exact-check.patch
diff --git a/icewm-ifstate-exact-check.patch b/icewm-ifstate-exact-check.patch
new file mode 100644 (file)
index 0000000..562268b
--- /dev/null
@@ -0,0 +1,51 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## ifstate_exact_check.dpatch by Eduard Bloch <blade@debian.org>
+##
+## DP: Check the state of the interface with SIOCGIFFLAGS instead of traversing the SIOCGIFCONF output, also checking the link state more exactly (Debian bug #563371)
+
+@DPATCH@
+Index: icewm-1.3.7~pre2/src/apppstatus.cc
+===================================================================
+--- icewm-1.3.7~pre2.orig/src/apppstatus.cc    2010-04-28 21:00:30.000000000 +0200
++++ icewm-1.3.7~pre2/src/apppstatus.cc 2010-04-29 22:11:16.961086255 +0200
+@@ -429,19 +429,18 @@
+     }
+     return false;
+ #else
+-    char buffer[32 * sizeof(struct ifreq)];
+-    struct ifconf ifc;
+-    struct ifreq *ifr;
+-    long long len;
+-
+     if (fNetDev == null)
+         return false;  
+-    
+-    int s = socket(PF_INET, SOCK_STREAM, 0);
++    int s = socket(PF_INET, SOCK_STREAM, 0);
+     if (s == -1)
+         return false;
++#if BROWSE_SIOCGIFCONF_LIST
++    char buffer[32 * sizeof(struct ifreq)];
++    struct ifconf ifc;
++    struct ifreq *ifr;
++    long long len;
+     ifc.ifc_len = sizeof(buffer);
+     ifc.ifc_buf = buffer;
+     if (ioctl(s, SIOCGIFCONF, &ifc) < 0) {
+@@ -459,6 +458,14 @@
+         ifr++;
+     }
++#else
++    struct ifreq ifr;
++    fNetDev.copy(ifr.ifr_name, IFNAMSIZ-1);
++    bool bUp = (ioctl(s, SIOCGIFFLAGS, &ifr) >= 0 && (ifr.ifr_flags & IFF_UP));
++    close(s);
++    return bUp;
++#endif
++
+     close(s);
+     return false;
+ #endif
This page took 0.047958 seconds and 4 git commands to generate.