[PATCH grout] api: fix external clients build
Andrei Rybchenko
rybchenko.andrei at gmail.com
Tue Mar 24 13:53:02 CET 2026
On 3/24/26 3:21 PM, Robin Jarry wrote:
> Robin Jarry, Mar 24, 2026 at 13:15:
>> Installing gr_string.h isn't the correct solution. We should remove the
>> include from gr_api_client_impl.h instead:
>
> Or preferably this other way that matches what gr_strcpy() is doing:
>
> diff --git api/gr_api_client_impl.h api/gr_api_client_impl.h
> index ca9a0f84e1b7..660caa42e60f 100644
> --- api/gr_api_client_impl.h
> +++ api/gr_api_client_impl.h
> @@ -8,7 +8,6 @@
> #include <gr_api.h>
> #include <gr_errno.h>
> #include <gr_macro.h>
> -#include <gr_string.h>
> #include <gr_version.h>
>
> #include <assert.h>
> @@ -50,8 +49,10 @@ struct gr_api_client *gr_api_client_connect(const char *sock_path) {
> goto err;
>
> addr.un.sun_family = AF_UNIX;
> - if (gr_strcpy(addr.un.sun_path, sizeof(addr.un.sun_path), sock_path) < 0)
> + if (memccpy(addr.un.sun_path, sock_path, 0, sizeof(addr.un.sun_path)) == NULL) {
> + errno = ENAMETOOLONG;
> goto err;
> + }
>
> if (connect(client->sock_fd, &addr.a, sizeof(addr.un)) < 0)
> goto err;
>
The solution looks good to me. Please, drop my patch.
Will you care about it?
More information about the grout
mailing list