Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0c620a5

Browse files
committed
Improve error messages after LoadLibrary()
Move the file name to a format parameter to ease translatability. Add error code where missing. Make the wording consistent.
1 parent e894c61 commit 0c620a5

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/backend/libpq/auth.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -1518,8 +1518,8 @@ pg_SSPI_recvauth(Port *port)
15181518
secur32 = LoadLibrary("SECUR32.DLL");
15191519
if (secur32 == NULL)
15201520
ereport(ERROR,
1521-
(errmsg_internal("could not load secur32.dll: error code %lu",
1522-
GetLastError())));
1521+
(errmsg("could not load library \"%s\": error code %lu",
1522+
"SECUR32.DLL", GetLastError())));
15231523

15241524
_QuerySecurityContextToken = (QUERY_SECURITY_CONTEXT_TOKEN_FN)
15251525
GetProcAddress(secur32, "QuerySecurityContextToken");
@@ -2517,7 +2517,8 @@ InitializeLDAPConnection(Port *port, LDAP **ldap)
25172517
* wldap32, but check anyway
25182518
*/
25192519
ereport(LOG,
2520-
(errmsg("could not load wldap32.dll")));
2520+
(errmsg("could not load library \"%s\": error code %lu",
2521+
"WLDAP32.DLL", GetLastError())));
25212522
ldap_unbind(*ldap);
25222523
return STATUS_ERROR;
25232524
}

src/common/restricted_token.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo)
6161
Advapi32Handle = LoadLibrary("ADVAPI32.DLL");
6262
if (Advapi32Handle == NULL)
6363
{
64-
pg_log_error("could not load advapi32.dll: error code %lu",
65-
GetLastError());
64+
pg_log_error("could not load library \"%s\": error code %lu",
65+
"ADVAPI32.DLL", GetLastError());
6666
return 0;
6767
}
6868

0 commit comments

Comments
 (0)