[PATCH 2/5] Turn sprintf argument into literaral string, shutting up gcc warning

Alan Coopersmith alan.coopersmith at oracle.com
Wed May 12 16:19:58 PDT 2010


Mikhail Gusarov wrote:
> Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
> ---
>  os/osinit.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/os/osinit.c b/os/osinit.c
> index e8fcd45..32747df 100644
> --- a/os/osinit.c
> +++ b/os/osinit.c
> @@ -161,7 +161,6 @@ void
>  OsInit(void)
>  {
>      static Bool been_here = FALSE;
> -    static char* admpath = ADMPATH;
>      static char* devnull = "/dev/null";
>      char fname[PATH_MAX];
>  
> @@ -229,8 +228,8 @@ OsInit(void)
>  	{
>  	    FILE *err;
>  
> -	    if (strlen (display) + strlen (admpath) + 1 < sizeof fname)
> -		sprintf (fname, admpath, display);
> +	    if (strlen (display) + strlen (ADMPATH) + 1 < sizeof fname)
> +		sprintf (fname, ADMPATH, display);
>  	    else
>  		strcpy (fname, devnull);
>  	    /*

You have a typo in "literal" in the patch description, but the code
looks fine.

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

-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list