From 6ba784e27f6d2a7023828263f988b7a2716fe614 Mon Sep 17 00:00:00 2001
From: BharatDBPG <bharatdbpg@gmail.com>
Date: Tue, 11 Nov 2025 17:36:29 +0530
Subject: [PATCH] Fix: prevent false exit() match in libpq static link check

The previous Makefile check used 'grep exit', which also matched
symbols like 'atexit' and 'OPENSSL_atexit' from libcrypto.a.
This caused false positive link failures when statically linking
libpq with OpenSSL.

Use 'grep -x exit' to match only the exact symbol name.

Signed-off-by: BharatDBPG <bharatdbpg@gmail.com>
---
 src/interfaces/libpq/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile
index da66500..8cff30b 100644
--- a/src/interfaces/libpq/Makefile
+++ b/src/interfaces/libpq/Makefile
@@ -144,7 +144,7 @@ $(stlib): $(OBJS_STATIC)
 libpq-refs-stamp: $(shlib)
 ifneq ($(enable_coverage), yes)
 ifeq (,$(filter solaris,$(PORTNAME)))
-	@if nm -A -u $< 2>/dev/null | grep -v -e __cxa_atexit -e __tsan_func_exit | grep exit; then \
+	@if nm -A -u $< 2>/dev/null | grep -v -e __cxa_atexit -e __tsan_func_exit | grep -x exit; then \
 		echo 'libpq must not be calling any function which invokes exit'; exit 1; \
 	fi
 endif
-- 
2.43.0

