This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
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