Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Remove obsolete comment and code from fe-auth.c.
authorThomas Munro <tmunro@postgresql.org>
Sun, 9 Jul 2023 03:52:28 +0000 (15:52 +1200)
committerThomas Munro <tmunro@postgresql.org>
Sun, 9 Jul 2023 04:05:34 +0000 (16:05 +1200)
We don't use getpwuid() anymore (see commit e757cdd6), so we don't need
locking around pg_get_user_name().

Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/CA%2BhUKGLtmexrpMtxBRLCVePqV_dtWG-ZsEbyPrYc%2BNBB2TkNsw%40mail.gmail.com

src/interfaces/libpq/fe-auth.c

index f8e09d3b415bc04f54a2d8269409e2214dc7d512..3ed8c6c89bad9a4c587645fe7a7aa1207acfac8a 100644 (file)
@@ -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;
 }