* Nils Carlson ([email protected]) wrote:
> Changes since v1:
> Cosmetic surgery at a european cost
> 

:-)

[...]

> +static int ustcomm_get_sock_name(char *dir_name, pid_t pid, char *sock_name)
> +{
> +     struct dirent *dirent;
> +     char sock_path_base[101];
> +     int len;
> +     DIR *dir = opendir(dir_name);
> +
> +     snprintf(sock_path_base, 100, "%ld.", (long) pid);

May I suggest to add

#define MAX_SOCK_PATH_BASE_LEN  100

and use

char sock_path_base[MAX_SOCK_PATH_BASE_LEN];

snprintf(sock_path_base, MAX_SOCK_PATH_BASE_LEN - 1, "%ld.", (long) pid);

?

Hardcoding fixed array width, especially when they have a close
relationship one to another, is usually frowned upon.

The rest looks good. If you proceed to this change, please add my

Acked-by: Mathieu Desnoyers <[email protected]>

Thanks,

Mathieu

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

_______________________________________________
ltt-dev mailing list
[email protected]
http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev

Reply via email to