On Wed, Aug 19, 2020 at 03:18:19PM +0200, mwi...@suse.com wrote:
> From: Martin Wilck <mwi...@suse.com>
> 
> This fixes a warning seen with gcc 10 on x86 (32 bit).
> Fix it by checking the snprintf() return value.
> 
Reviewed-by: Benjamin Marzinski <bmarz...@redhat.com>
> Signed-off-by: Martin Wilck <mwi...@suse.com>
> ---
>  libmultipath/util.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libmultipath/util.c b/libmultipath/util.c
> index 207e63c..1512424 100644
> --- a/libmultipath/util.c
> +++ b/libmultipath/util.c
> @@ -250,9 +250,9 @@ int systemd_service_enabled_in(const char *dev, const 
> char *prefix)
>               p = d->d_name + strlen(d->d_name) - 6;
>               if (strcmp(p, ".wants"))
>                       continue;
> -             snprintf(file, sizeof(file), "%s/%s/%s",
> -                      path, d->d_name, service);
> -             if (stat(file, &stbuf) == 0) {
> +             if (!safe_sprintf(file, "%s/%s/%s",
> +                               path, d->d_name, service)
> +                 && stat(file, &stbuf) == 0) {
>                       condlog(3, "%s: found %s", dev, file);
>                       found++;
>                       break;
> -- 
> 2.28.0

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

Reply via email to