From ead4bf997d079fa20050c61f17b5348714e02d19 Mon Sep 17 00:00:00 2001
From: Mahendra Singh Thalor <mahi6run@gmail.com>
Date: Mon, 20 Jul 2026 15:31:00 +0530
Subject: [PATCH v2] pg_dump: Fix argument type passed to check_mut_excl_opts()

check_mut_excl_opts()'s internal varargs reader retrieves each
"is this option set" flag via va_arg(args, int). The
--include-foreign-data check passed
foreign_servers_include_patterns.head (a pointer) directly for that
slot, which is not guaranteed to be read back correctly through an
int-typed va_arg. Pass a boolean derived from a NULL comparison
instead.
---
 src/bin/pg_dump/pg_dump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 4948e6d80c7..890479e51eb 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -849,7 +849,7 @@ main(int argc, char **argv)
 						schema_only, "-s/--schema-only");
 
 	/* --include-foreign-data is incompatible with --schema-only */
-	check_mut_excl_opts(foreign_servers_include_patterns.head, "--include-foreign-data",
+	check_mut_excl_opts(foreign_servers_include_patterns.head != NULL, "--include-foreign-data",
 						schema_only, "-s/--schema-only");
 
 	if (numWorkers > 1 && foreign_servers_include_patterns.head != NULL)
-- 
2.52.0

