[PATCH] Fix format-nonliteral warnings

Jeremy Allison jra at samba.org
Tue Aug 23 23:14:09 UTC 2016


On Tue, Aug 23, 2016 at 04:08:14PM -0700, Jeremy Allison wrote:
> On Tue, Aug 23, 2016 at 03:27:42PM +1000, Amitay Isaacs wrote:
> > On Mon, Aug 22, 2016 at 3:41 PM, Martin Schwenke <martin at meltin.net> wrote:
> > 
> > > On Mon, 22 Aug 2016 03:19:34 +1000, Amitay Isaacs <amitay at gmail.com>
> > > wrote:
> > >
> > > > Adding printf format decorations have thrown up more warnings. Here are
> > > two
> > > > additional patches that fix the new warnings.
> > >
> > > As far as I can tell, the only place that sprintf_append() is called is
> > > in the torture test that is producing the warning:
> > >
> > >   $ git grep -w sprintf_append
> > >   source3/include/proto.h:void sprintf_append(TALLOC_CTX *mem_ctx, char
> > > **string, ssize_t *len,
> > >   source3/lib/util_str.c:void sprintf_append(TALLOC_CTX *mem_ctx, char
> > > **string, ssize_t *len,
> > >   source3/selftest/tests.py:    "LOCAL-sprintf_append",
> > >   source3/torture/t_strappend.c: * Test harness for sprintf_append
> > >   source3/torture/t_strappend.c:  sprintf_append(mem_ctx, &string, &len,
> > > &bufsize, "");
> > >   source3/torture/t_strappend.c:  sprintf_append(mem_ctx, &string, &len,
> > > &bufsize, "");
> > >   source3/torture/t_strappend.c:  sprintf_append(mem_ctx, &string, &len,
> > > &bufsize,
> > >   source3/torture/t_strappend.c:          sprintf_append(mem_ctx, &string,
> > > &len, &bufsize, "%d\n", i);
> > >   source3/torture/t_strappend.c:                  fprintf(stderr,
> > > "sprintf_append failed: strlen(string) %lld != len %lld\n",
> > >   source3/torture/torture.c:      { "LOCAL-sprintf_append",
> > > run_local_sprintf_append, 0},
> > >
> > > Code has probably changed to use talloc_asprintf_append().
> > >
> > > Given that testing of unused code is throwing up warnings, should we
> > > just remove the code and the test?
> > >
> > >
> > Good point.  Here is a complete patchset again with two changes.
> > 
> > - the first patch in the series removes the unused function sprintf_append
> > - the last patch in the series fixes printf format string and arguments
> 
> LGTM. Pushed !

With spelling mistakes fixed :-).



More information about the samba-technical mailing list