On Tue, Dec 29, 2015 at 11:17:12PM +0100, Samuel Thibault wrote: > Flavio Cruz, on Tue 29 Dec 2015 23:10:44 +0100, wrote: > > --- > > Oops, no: I meant the *comment* after the ---, the changelog has to go > before the ---, that's where git am picks it up. > > > @@ -72,7 +72,7 @@ init_filesystems (void) > > > > for (line = 1; ; line++) > > { > > - nitems = fscanf (index_file, "%d %as\n", &index, &name); > > + nitems = fscanf (index_file, "%d %as\n", &index, (float *)&name); > > I'm pretty sure that wasn't the original purpose :) I guess the 'a' > qualifier is meant to mean 'allocate whatever size is needed'.
Looks like %a is now used for floats (that's why I blindly added the cast). The recommended way described in http://man7.org/linux/man-pages/man3/scanf.3.html is to use %ms: "The use of the letter a for this purpose was problematic, since a is also specified by the ISO C standard as a synonym for f (floating- point input). POSIX.1-2008 instead specifies the m modifier for assignment allocation (as documented in DESCRIPTION, above)." I guess this will probably fix a bug in the code :) --- diff --git a/nfsd/fsys.c b/nfsd/fsys.c index 7b15d15..f746716 100644 --- a/nfsd/fsys.c +++ b/nfsd/fsys.c @@ -72,7 +72,7 @@ init_filesystems (void) for (line = 1; ; line++) { - nitems = fscanf (index_file, "%d %as\n", &index, &name); + nitems = fscanf (index_file, "%d %ms\n", &index, &name); if (nitems == EOF) { fclose (index_file);