components/mtr/patches/FINBIO.patch
branchs11-update
changeset 4058 2c35b27b5cde
equal deleted inserted replaced
4033:f7924751c494 4058:2c35b27b5cde
       
     1 This fixes an upstream bug:
       
     2 
       
     3     https://github.com/traviscross/mtr/issues/35
       
     4 
       
     5 The patch is from
       
     6 
       
     7     https://bugs.launchpad.net/mtr/+bug/1273486/comments/5
       
     8 
       
     9 --- mtr-0.86/net.c	2014-12-09 03:20:57.000000000 -0800
       
    10 +++ mtr-0.86/net.c	2015-03-20 09:43:55.576572132 -0700
       
    11 @@ -301,7 +301,7 @@ void net_send_tcp(int index)
       
    12  void net_send_tcp(int index)
       
    13  {
       
    14    int ttl, s;
       
    15 -  int opt = 1;
       
    16 +  int flags;
       
    17    int port;
       
    18    struct sockaddr_storage local;
       
    19    struct sockaddr_storage remote;
       
    20 @@ -354,10 +354,10 @@ void net_send_tcp(int index)
       
    21      exit(EXIT_FAILURE);
       
    22    }
       
    23  
       
    24 -  opt = 1;
       
    25 -  if (ioctl(s, FIONBIO, &opt)) {
       
    26 +  flags = fcntl(s, F_GETFL, 0);
       
    27 +  if (fcntl(s, F_SETFL, flags | O_NONBLOCK) == -1) {
       
    28      display_clear();
       
    29 -    perror("ioctl FIONBIO");
       
    30 +    perror("fcntl F_SETFL(O_NONBLOCK)");
       
    31      exit(EXIT_FAILURE);
       
    32    }
       
    33