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

[netCDF #DQF-666714]: [netcdfgroup] NetCDF 4.1.1 did not compile dumplib.c because of the format missing in a snprintf



Hi Philippe,

> When compiling with gcc 4.4.1 (from a mandriva 2010 distribution)
> there is an error on a call to snprintf (the format is missing).
> Here is the patch which corrects this:
> 
> --- ncdump/dumplib.c.orig    2010-04-26 18:12:49.000000000 +0200
> +++ ncdump/dumplib.c    2010-04-26 18:18:29.000000000 +0200
> @@ -1005,7 +1005,7 @@
> char *prefix = "0X";
> int prelen = strlen(prefix);
> 
> -    snprintf(sp, prelen + 1, prefix);
> +    snprintf(sp, prelen + 1, "%s", prefix);
> sp += prelen;
> for(i = 0; i < size; i++) {
> int res;

Thanks, I will include your fix in the next snapshot release.

However, I'm still not sure this really an error in the dumplib.c source 
rather than in gcc 4.4.1.

According to my reading of the snprintf man page, prefix is the format in
this case and the ordinary characters in that format, "0x", are merely 
copied to the output stream:

   ...  The format is composed of zero or more directives: ordinary
   characters, which are simply copied to the output stream and
   conversion specifications, each of which results in the fetching of
   zero or more arguments.

--Russ

Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: DQF-666714
Department: Support netCDF
Priority: Normal
Status: Closed