]> git.pld-linux.org Git - packages/icewm.git/blob - icewm-ifstate-exact-check.patch
- from debian, description inside
[packages/icewm.git] / icewm-ifstate-exact-check.patch
1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## ifstate_exact_check.dpatch by Eduard Bloch <blade@debian.org>
3 ##
4 ## 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)
5
6 @DPATCH@
7 Index: icewm-1.3.7~pre2/src/apppstatus.cc
8 ===================================================================
9 --- icewm-1.3.7~pre2.orig/src/apppstatus.cc     2010-04-28 21:00:30.000000000 +0200
10 +++ icewm-1.3.7~pre2/src/apppstatus.cc  2010-04-29 22:11:16.961086255 +0200
11 @@ -429,19 +429,18 @@
12      }
13      return false;
14  #else
15 -    char buffer[32 * sizeof(struct ifreq)];
16 -    struct ifconf ifc;
17 -    struct ifreq *ifr;
18 -    long long len;
19 -
20      if (fNetDev == null)
21          return false;  
22 -    
23 -    int s = socket(PF_INET, SOCK_STREAM, 0);
24  
25 +    int s = socket(PF_INET, SOCK_STREAM, 0);
26      if (s == -1)
27          return false;
28  
29 +#if BROWSE_SIOCGIFCONF_LIST
30 +    char buffer[32 * sizeof(struct ifreq)];
31 +    struct ifconf ifc;
32 +    struct ifreq *ifr;
33 +    long long len;
34      ifc.ifc_len = sizeof(buffer);
35      ifc.ifc_buf = buffer;
36      if (ioctl(s, SIOCGIFCONF, &ifc) < 0) {
37 @@ -459,6 +458,14 @@
38          ifr++;
39      }
40  
41 +#else
42 +    struct ifreq ifr;
43 +    fNetDev.copy(ifr.ifr_name, IFNAMSIZ-1);
44 +    bool bUp = (ioctl(s, SIOCGIFFLAGS, &ifr) >= 0 && (ifr.ifr_flags & IFF_UP));
45 +    close(s);
46 +    return bUp;
47 +#endif
48 +
49      close(s);
50      return false;
51  #endif
This page took 0.030763 seconds and 3 git commands to generate.