<div dir="ltr"><div dir="ltr"><div dir="ltr"></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">пт, 8 февр. 2019 г. в 13:01, Cyrill Gorcunov <<a href="mailto:gorcunov@gmail.com">gorcunov@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Fri, Feb 08, 2019 at 11:59:20AM +0300, Pavel Tikhomirov wrote:<br>
> +<br>
> + len = snprintf(path_dir1, sizeof(path_dir1), "%s/%s", dirname,<br>
> "gd1");<br>
> + if (len == sizeof(path_dir1)) path_dir1[len-1] = '\0';<br>
> <br>
> Expression above is strange as snprintf always prints terminating null<br>
> byte, even if it needs to truncate the output. In other code we either<br>
> ignore the return of snprintf assuming that we can't have truncation or do<br>
> check error like: if (len >= sizeof(path_dir1)) return -1;<br>
<br>
It is for warnings suppression nothing else. Strictly speaking we might<br>
need to check for negative value rather but since it is path-max limit<br>
i don't expect here any errors at all, just to placate gcc.<br></blockquote><div><br></div><div>FMPOV actual overflow check is better here, it is what gcc really wants from us by these warnings.<br></div><div><br></div><div>Except that, Reviewed-by: Pavel Tikhomirov <<a href="mailto:ptikhomirov@virtuozzo.com">ptikhomirov@virtuozzo.com</a>><br></div></div></div></div>