[PATCH xserver] test: Fix a thinko in simple-xinit

Alan Coopersmith alan.coopersmith at oracle.com
Mon Sep 25 19:23:48 UTC 2017


On 09/25/17 12:01 PM, Adam Jackson wrote:
> Spotted by clang courtesy of the shiny new OSX Travis target:
> 
> simple-xinit.c:90:65: warning: sizeof on pointer operation will return size of 'char *' instead of 'char [10]' [-Wsizeof-array-decay]
>      ret = read(displayfd, display_string, sizeof(display_string - 1));
> 
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>   test/simple-xinit.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/test/simple-xinit.c b/test/simple-xinit.c
> index 1fc31be269..26ff12bf73 100644
> --- a/test/simple-xinit.c
> +++ b/test/simple-xinit.c
> @@ -87,7 +87,7 @@ get_display(int displayfd)
>       char display_string[10];
>       ssize_t ret;
>   
> -    ret = read(displayfd, display_string, sizeof(display_string - 1));
> +    ret = read(displayfd, display_string, sizeof(display_string) - 1);
>       if (ret <= 0) {
>           fprintf(stderr, "Failed reading displayfd: %s\n", strerror(errno));
>           exit(1);
> 

Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

-- 
	-Alan Coopersmith-               alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - https://blogs.oracle.com/alanc


More information about the xorg-devel mailing list