On Thu, Jan 6, 2011 at 6:32 PM, Jeremy Evans <[email protected]> wrote:
> This patch adds unix datagram socket support to nc(1). It's basically
> the same patch I sent last June (see
> http://marc.info/?l=openbsd-tech&m=127627296925965&w=2), but updated
> for -current.
>
> Tested on amd64. Doesn't appear to cause any regressions to existing
> support, tested with unix stream and IP stream and datagram sockets.
> Looking for OKs.
Why is the socket name specified via -p for datagrams or possibly
random? Shouldn't this be just like the stream unix code?
> + /* Get name of temporary socket for unix datagram client */
> + if ((family == AF_UNIX) && uflag && !lflag) {
> + if(pflag) {
> + unix_dg_tmp_socket = pflag;
> + } else {
> + if((unix_dg_tmp_socket = (char *)malloc(19)) ==
NULL)
> + errx(1, "not enough memory");
> + strlcpy(unix_dg_tmp_socket, "/tmp/nc.XXXXXXXXXX",
19);
> + mktemp(unix_dg_tmp_socket);
> + }
> + }
> +