path: root/src/expr.c
diff options
authorNicholas Vinson <>2022-06-15 07:35:28 -0400
committerFlorian Westphal <>2022-06-15 13:54:44 +0200
commit84d12cfacf8ddd857a09435f3d982ab6250d250c (patch)
tree1bf88d72d633faf94e80e04e0f93598ce6f4110a /src/expr.c
parentf6575131e60ab10f131ea3ff36f69af2b6c3f614 (diff)
build: fix clang+glibc snprintf substitution errorHEADmaster
When building with clang and glibc and -D_FORTIFY_SOURCE=2 is passed to clang, the snprintf member of the expr_ops and obj_ops structures will be incorrectly replaced with __builtin_snprintf_chk() which results in "error: no member named '__builtin___snprintf_chk'" errors at build time. This patch changes the member name from 'snprintf' to 'output' to prevent the replacement. This bug can be emulated using GCC by undefining the __va_arg_pack macro before stdio.h is included. This patch is based on the notes provided in Signed-off-by: Nicholas Vinson <> Signed-off-by: Florian Westphal <>
Diffstat (limited to 'src/expr.c')
1 files changed, 2 insertions, 2 deletions
diff --git a/src/expr.c b/src/expr.c
index 277bbde..b4581f1 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -279,10 +279,10 @@ int nftnl_expr_snprintf(char *buf, size_t remain, const struct nftnl_expr *expr,
if (remain)
buf[0] = '\0';
- if (!expr->ops->snprintf || type != NFTNL_OUTPUT_DEFAULT)
+ if (!expr->ops->output || type != NFTNL_OUTPUT_DEFAULT)
return 0;
- ret = expr->ops->snprintf(buf + offset, remain, flags, expr);
+ ret = expr->ops->output(buf + offset, remain, flags, expr);
SNPRINTF_BUFFER_SIZE(ret, remain, offset);
return offset;