1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00

fstab-generator: quiesce false-positive -Werror=format-nonliteral (#5336)

Commit ae3251851 changed the fprintf() format argument into a variable
which triggers a gcc 6.3 warning/error:

  src/fstab-generator/fstab-generator.c:243:17: error: format not a string literal,
  argument types not checked [-Werror=format-nonliteral]
                 fprintf(f, format, res);

This is a false positive, as the function is only being called with
constant (not user-definable) arguments which are valid format strings.
This commit is contained in:
Martin Pitt 2017-02-14 02:58:22 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent ae3251851a
commit 4a027e1935

View File

@ -240,7 +240,10 @@ static int write_dependency(FILE *f, const char *opts,
res = strv_join(units, " ");
if (!res)
return log_oom();
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
fprintf(f, format, res);
#pragma GCC diagnostic pop
}
return 0;