On Thu, Nov 08, 2018 at 02:12:35PM -0700, Alexander Bluhm wrote:
> Hi,
>
> It is easier to write race free tests if netcat reports when the
> listen system call has finished. This avoids ugly kernel lookups
> with fstat. Just report bind or listen like accepted connections
> in verbose mode to stderr. Then the other end can proceed.
>
> ok?
ok (with one tiny nit below)
> @@ -1037,6 +1044,16 @@ local_listen(const char *host, const cha
> if (listen(s, 1) < 0)
> err(1, "listen");
> }
> + if (vflag && s != -1) {
> + struct sockaddr_storage ss;
> + socklen_t len;
> +
> + len = sizeof(ss);
> + if (getsockname(s, (struct sockaddr *)&ss, &len) == -1)
> + err(1, "getsockname");
indent with a tab instead of four spaces.