Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
3312b8ed
Commit
3312b8ed
authored
23 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
Load netmsg.dll locally in winsock_strerror, to avoid actual and
potential problems discussed in pgsql-interfaces.
parent
9d596e0e
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/interfaces/libpq/fe-misc.c
+39
-19
39 additions, 19 deletions
src/interfaces/libpq/fe-misc.c
src/interfaces/libpq/libpqdll.c
+1
-5
1 addition, 5 deletions
src/interfaces/libpq/libpqdll.c
src/interfaces/libpq/win32.h
+2
-5
2 additions, 5 deletions
src/interfaces/libpq/win32.h
with
42 additions
and
29 deletions
src/interfaces/libpq/fe-misc.c
+
39
−
19
View file @
3312b8ed
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.6
3
2001/11/2
7
1
8:21:51
tgl Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.6
4
2001/11/2
8
1
9:40:29
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -37,6 +37,8 @@
...
@@ -37,6 +37,8 @@
#include
<time.h>
#include
<time.h>
#ifdef WIN32
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include
<windows.h>
#include
"win32.h"
#include
"win32.h"
#else
#else
#include
<unistd.h>
#include
<unistd.h>
...
@@ -858,41 +860,59 @@ libpq_gettext(const char *msgid)
...
@@ -858,41 +860,59 @@ libpq_gettext(const char *msgid)
* If you can verify this working on win9x or have a solution, let us know, ok?
* If you can verify this working on win9x or have a solution, let us know, ok?
*/
*/
const
char
*
const
char
*
winsock_strerror
(
DWORD
eno
)
winsock_strerror
(
int
eno
)
{
{
#define WSSE_MAXLEN (sizeof(winsock_strerror_buf)-1-12)
/* 12 == "(0x00000000)" */
static
char
err_buf
[
512
];
#define WSSE_MAXLEN (sizeof(err_buf)-1-13)
/* 13 == " (0x00000000)" */
HINSTANCE
netmsgModule
;
int
length
;
int
length
;
/* First try the "system table", this works on Win2k pro */
/* First try the "system table", this works on Win2k pro */
if
(
FormatMessage
(
if
(
FormatMessage
(
FORMAT_MESSAGE_IGNORE_INSERTS
|
FORMAT_MESSAGE_FROM_SYSTEM
,
FORMAT_MESSAGE_IGNORE_INSERTS
|
FORMAT_MESSAGE_FROM_SYSTEM
,
0
,
eno
,
MAKELANGID
(
LANG_NEUTRAL
,
SUBLANG_DEFAULT
),
0
,
winsock_strerror_buf
,
WSSE_MAXLEN
,
NULL
eno
,
))
MAKELANGID
(
LANG_NEUTRAL
,
SUBLANG_DEFAULT
),
err_buf
,
WSSE_MAXLEN
,
NULL
))
goto
WSSE_GOODEXIT
;
goto
WSSE_GOODEXIT
;
/* That didn't work, let's try the netmsg.dll */
/* That didn't work, let's try the netmsg.dll */
if
(
netmsgModule
&&
netmsgModule
=
LoadLibraryEx
(
"netmsg.dll"
,
FormatMessage
(
NULL
,
FORMAT_MESSAGE_IGNORE_INSERTS
|
FORMAT_MESSAGE_FROM_HMODULE
,
LOAD_LIBRARY_AS_DATAFILE
);
0
,
eno
,
MAKELANGID
(
LANG_NEUTRAL
,
SUBLANG_DEFAULT
),
winsock_strerror_buf
,
WSSE_MAXLEN
,
NULL
if
(
netmsgModule
!=
NULL
)
))
{
goto
WSSE_GOODEXIT
;
if
(
FormatMessage
(
FORMAT_MESSAGE_IGNORE_INSERTS
|
FORMAT_MESSAGE_FROM_HMODULE
,
netmsgModule
,
eno
,
MAKELANGID
(
LANG_NEUTRAL
,
SUBLANG_DEFAULT
),
err_buf
,
WSSE_MAXLEN
,
NULL
))
{
FreeLibrary
(
netmsgModule
);
goto
WSSE_GOODEXIT
;
}
FreeLibrary
(
netmsgModule
);
}
/* Everything failed, just tell the user that we don't know the desc */
/* Everything failed, just tell the user that we don't know the desc */
strcpy
(
winsock_strerro
r_buf
,
"Socket error, no description available."
);
strcpy
(
er
r_buf
,
"Socket error, no description available."
);
WSSE_GOODEXIT:
WSSE_GOODEXIT:
length
=
strlen
(
winsock_strerro
r_buf
);
length
=
strlen
(
er
r_buf
);
sprintf
(
winsock_strerro
r_buf
+
(
length
<
WSSE_MAXLEN
?
length
:
WSSE_MAXLEN
),
sprintf
(
er
r_buf
+
(
length
<
WSSE_MAXLEN
?
length
:
WSSE_MAXLEN
),
"(0x%08X)"
,
eno
);
"
(0x%08X)"
,
eno
);
return
winsock_strerro
r_buf
;
return
er
r_buf
;
}
}
#endif
#endif
This diff is collapsed.
Click to expand it.
src/interfaces/libpq/libpqdll.c
+
1
−
5
View file @
3312b8ed
#define WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#include
<windows.h>
#include
<windows.h>
#include
<winsock.h>
#include
"win32.h"
#include
"win32.h"
BOOL
WINAPI
BOOL
WINAPI
DllMain
(
HINSTANCE
hinstDLL
,
DWORD
fdwReason
,
DllMain
(
HINSTANCE
hinstDLL
,
DWORD
fdwReason
,
LPVOID
lpReserved
)
LPVOID
lpReserved
)
...
@@ -20,12 +20,8 @@ DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
...
@@ -20,12 +20,8 @@ DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
*/
*/
return
FALSE
;
return
FALSE
;
}
}
if
(
netmsgModule
==
NULL
)
netmsgModule
=
LoadLibraryEx
(
"netmsg.dll"
,
NULL
,
LOAD_LIBRARY_AS_DATAFILE
);
break
;
break
;
case
DLL_PROCESS_DETACH
:
case
DLL_PROCESS_DETACH
:
if
(
netmsgModule
!=
NULL
)
FreeLibrary
(
netmsgModule
);
WSACleanup
();
WSACleanup
();
break
;
break
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/interfaces/libpq/win32.h
+
2
−
5
View file @
3312b8ed
...
@@ -31,9 +31,6 @@
...
@@ -31,9 +31,6 @@
#define EINPROGRESS WSAEINPROGRESS
#define EINPROGRESS WSAEINPROGRESS
/*
/*
*
Windows network messaging stuff:
*
support for handling Windows Socket errors
*/
*/
static
HINSTANCE
netmsgModule
=
NULL
;
extern
const
char
*
winsock_strerror
(
int
eno
);
static
char
winsock_strerror_buf
[
512
];
const
char
*
winsock_strerror
(
DWORD
eno
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment