[racket-dev] tcp_listen error handling

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue May 21 08:39:24 EDT 2013

Yes, I think 
 
   address ? address : "#f" 

is right, while "host not found" should change to something like "host
lookup failed".

At Tue, 21 May 2013 04:57:25 +0300, Alex Moiseenko wrote:
> Hi. I've successfully started Racket 5.3.4.7 with Geiser server through JNI + 
> SDL2 on Android (and this combination mostly works with small hacks), but got 
> some issues due to racket's implementation. This is last one I'm trying to 
> understand. What should be here instead of the "address" expression?
> 
> 2349    } else {
> 2350      scheme_raise_exn(MZEXN_FAIL_NETWORK,
> 2351                       "tcp-listen: host not found\n"
> 2352                       " address: %s\n"
> 2353                       " system error: %N",
> 2354                       address, 1, err);
> 2355      return NULL;
> 2356    }
> 2357  }
> https://github.com/plt/racket/blob/master/src/racket/src/network.c#L2354
> 
> It looks like there should be (but i'm not sure)
> 
>    address ? address : "#f" // as i see at another place, because it's 
> possible to have NULL according to the:
> 
> https://github.com/plt/racket/blob/master/src/racket/src/network.c#L2147
> 
> Without such change I got segfault because sch_vsprintf tried to process NULL 
> pointer, when i forgot to grant internet permissions for my application and 
> tried to call start-geiser function (getaddrinfo returns fail in this 
> situation and this `else` block is called).
> 
> 
> 
> -- 
> Alex Moiseenko
> _________________________
>   Racket Developers list:
>   http://lists.racket-lang.org/dev

Posted on the dev mailing list.