[Toybox] [PATCH] netcat: Add UNIX domain socket support (-U)

Tom Cherry tomcherry at google.com
Mon Jul 1 13:07:20 PDT 2019


On Mon, Jul 1, 2019 at 12:57 PM Rob Landley <rob at landley.net> wrote:
>
> On 7/1/19 2:34 PM, Tom Cherry via Toybox wrote:
> > Other implementations of netcat support UNIX domain sockets via -U, so
> > this change adds it to toybox too.
>
> I don't understand this bit?
>
> @@ -136,7 +177,7 @@ void netcat_main(void)
>
>        do {
>          child = 0;
> -        in1 = out2 = accept(sockfd, (struct sockaddr *)address, &len);
> +        in1 = out2 = accept(sockfd, NULL, NULL);
>          if (in1<0) perror_exit("accept");

I was rearranging the variable declarations and saw that address is
both used in the if statement where I moved their declaration and for
accept().  It is an output parameter for accept(), but isn't used
after, and since accept() is specified to allow NULL, NULL here if the
output parameters aren't used, I removed them.

I can go back to the original to make this diff smaller if you'd like.

Tom

> Rob



More information about the Toybox mailing list