[PATCH] Fix format-nonliteral warnings

Martin Schwenke martin at meltin.net
Mon Aug 22 05:41:38 UTC 2016


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?

peace & happiness,
martin



More information about the samba-technical mailing list