From 4d0d568fba15543070e7b7e501e1748ae6aab821 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Fri, 9 Jun 2023 13:56:21 +1200
Subject: [PATCH 1/5] Remove obsolete comments and code from fe-auth.c.

We don't use getpwuid() anymore (see commit e757cdd6), so we don't need
locking around pg_get_user_name().
---
 src/interfaces/libpq/fe-auth.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c
index 88fd0f3d80..b65333268f 100644
--- a/src/interfaces/libpq/fe-auth.c
+++ b/src/interfaces/libpq/fe-auth.c
@@ -1179,15 +1179,6 @@ pg_fe_getusername(uid_t user_id, PQExpBuffer errorMessage)
 	char		pwdbuf[BUFSIZ];
 #endif
 
-	/*
-	 * Some users are using configure --enable-thread-safety-force, so we
-	 * might as well do the locking within our library to protect getpwuid().
-	 * In fact, application developers can use getpwuid() in their application
-	 * if they use the locking call we provide, or install their own locking
-	 * function using PQregisterThreadLock().
-	 */
-	pglock_thread();
-
 #ifdef WIN32
 	if (GetUserName(username, &namesize))
 		name = username;
@@ -1209,8 +1200,6 @@ pg_fe_getusername(uid_t user_id, PQExpBuffer errorMessage)
 			libpq_append_error(errorMessage, "out of memory");
 	}
 
-	pgunlock_thread();
-
 	return result;
 }
 
-- 
2.39.2

