[Babel-users] [PATCH] Add support for unix-domain local socket

Juliusz Chroboczek jch at pps.univ-paris-diderot.fr
Fri Feb 12 17:28:01 UTC 2016


Thanks, Julien.

> I guess you'll tell me you don't put spaces between "if" and "(", and I
> should use consistent style.

I can easily edit that myself.

> case 'g':

This case is very similar to 'G' below.  Please refactor to share the two
cases (with an if inside).

> +                strncpy(local_server_path, optarg, sizeof(local_server_path));

Plase make local_server_path a pointer, and either keep a pointer to the
argv element, or strdup it if you're paranoid.  See below why.

> +        else if(strcmp(token, "local-path") == 0) {
> +            if (strlen(file) >= sizeof(local_server_path))
> +                goto error;
> +            local_server_port = -1;
> +            strncpy(local_server_path, file, sizeof(local_server_path));
> +            local_server_write = 0;

Memory leak.  File is dynamically allocated, so you need to free it at
some point.  If you just make local_server_path a pointer, no need to
copy, just keep a reference to it.

-- Juliusz



More information about the Babel-users mailing list