[racket-dev] tcp_listen error handling

From: Alex Moiseenko (imdagger at yandex.ru)
Date: Mon May 20 21:57:25 EDT 2013

Hi. I've successfully started Racket 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  }

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:


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

Posted on the dev mailing list.