[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH 2/2] fix a -Wformat (boy, that's a bloody serious error)



On Sat, Apr 18, 2015 at 11:27:39PM +0300, Andrei Zavada wrote:
> ---
>  libMems/dmSML/dmsort.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libMems/dmSML/dmsort.c b/libMems/dmSML/dmsort.c
> index 4c99215..2cbfa7e 100644
> --- a/libMems/dmSML/dmsort.c
> +++ b/libMems/dmSML/dmsort.c
> @@ -825,7 +825,7 @@ int InitdmSML( long working_mb, long buffer_size, const char* input_filename, co
>  		if ( fgets(buf, sizeof(buf), fp) )
>  		{
>  			sscanf(buf, "MemTotal: %ld kB", &memTotal);
> -			fprintf( stderr, buf );
> +			fprintf( stderr, "%s", buf );

Maybe
  fputs(buf, stderr)
to avoid printf entirely since it's not needed for formatting?


Regards,
Roger

-- 
Dr Roger Leigh -- Open Microscopy Environment
Wellcome Trust Centre for Gene Regulation and Expression,
College of Life Sciences, University of Dundee, Dow Street,
Dundee DD1 5EH Scotland UK   Tel: (01382) 386364 


Reply to: