Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
b00d50d3
Commit
b00d50d3
authored
Apr 22, 2004
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Per discussion earlier today, here is a fix that lets ereport() on win32
report socket errors. Magnus Hagander
parent
a4d9d3e0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
3 deletions
+42
-3
src/backend/port/win32/socket.c
src/backend/port/win32/socket.c
+33
-1
src/backend/utils/error/elog.c
src/backend/utils/error/elog.c
+6
-1
src/include/port/win32.h
src/include/port/win32.h
+3
-1
No files found.
src/backend/port/win32/socket.c
View file @
b00d50d3
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/port/win32/socket.c,v 1.
1 2004/04/12 16:19:18
momjian Exp $
* $PostgreSQL: pgsql/src/backend/port/win32/socket.c,v 1.
2 2004/04/22 03:50:54
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -432,3 +432,35 @@ int pgwin32_select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfd
return
nummatches
;
}
/*
* Return win32 error string, since strerror can't
* handle winsock codes
*/
static
char
wserrbuf
[
256
];
const
char
*
pgwin32_socket_strerror
(
int
err
)
{
static
HANDLE
handleDLL
=
INVALID_HANDLE_VALUE
;
if
(
handleDLL
==
INVALID_HANDLE_VALUE
)
{
handleDLL
=
LoadLibraryEx
(
"netmsg.dll"
,
NULL
,
DONT_RESOLVE_DLL_REFERENCES
|
LOAD_LIBRARY_AS_DATAFILE
);
if
(
handleDLL
==
NULL
)
ereport
(
FATAL
,
(
errmsg_internal
(
"Failed to load netmsg.dll: %i"
,(
int
)
GetLastError
())));
}
ZeroMemory
(
&
wserrbuf
,
sizeof
(
wserrbuf
));
if
(
FormatMessage
(
FORMAT_MESSAGE_IGNORE_INSERTS
|
FORMAT_MESSAGE_FROM_SYSTEM
|
FORMAT_MESSAGE_FROM_HMODULE
,
handleDLL
,
err
,
MAKELANGID
(
LANG_NEUTRAL
,
SUBLANG_DEFAULT
),
wserrbuf
,
sizeof
(
wserrbuf
)
-
1
,
NULL
)
==
0
)
{
/* Failed to get id */
sprintf
(
wserrbuf
,
"Unknown winsock error %i"
,
err
);
}
return
wserrbuf
;
}
src/backend/utils/error/elog.c
View file @
b00d50d3
...
...
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.13
4 2004/04/16 12:59:05
momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.13
5 2004/04/22 03:51:09
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1661,6 +1661,11 @@ useful_strerror(int errnum)
static
char
errorstr_buf
[
48
];
const
char
*
str
;
#ifdef WIN32
/* Winsock error code range, per WinError.h */
if
(
errnum
>=
10000
&&
errnum
<=
11999
)
return
pgwin32_socket_strerror
(
errnum
);
#endif
str
=
strerror
(
errnum
);
/*
...
...
src/include/port/win32.h
View file @
b00d50d3
/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.2
2 2004/04/19 17:42:59
momjian Exp $ */
/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.2
3 2004/04/22 03:51:24
momjian Exp $ */
/* undefine and redefine after #include */
#undef mkdir
...
...
@@ -139,6 +139,8 @@ int pgwin32_connect(SOCKET s, const struct sockaddr* name, int namelen);
int
pgwin32_select
(
int
nfds
,
fd_set
*
readfs
,
fd_set
*
writefds
,
fd_set
*
exceptfds
,
const
struct
timeval
*
timeout
);
int
pgwin32_recv
(
SOCKET
s
,
char
*
buf
,
int
len
,
int
flags
);
int
pgwin32_send
(
SOCKET
s
,
char
*
buf
,
int
len
,
int
flags
);
const
char
*
pgwin32_socket_strerror
(
int
err
);
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment