Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 30debec

Browse files
committed
Hello!
Here are two new patches for the Win32 support. 1) The patch based on the one from Hiroshi Inoue [[email protected]], to load Winsock.dll from libpq.dll. 2) A patch for psql.c to remove the call to WSAStartup(), since it is not required when it's done in libpq.dll. I'm still looking for the possibility of having a crypt() function in libpq.dll too, the same way getopt was included. Any chance of getting this before 6.4, or should we wait for the next one? //Magnus
1 parent cb4292e commit 30debec

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

src/backend/commands/vacuum.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.84 1998/10/07 22:31:50 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.85 1998/10/08 00:10:46 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -558,7 +558,6 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
558558
vacrelstats->num_tuples, vacrelstats->hasindex, vacrelstats);
559559

560560
/* next command frees attribute stats */
561-
562561
CommitTransactionCommand();
563562
}
564563

src/bin/psql/psql.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.161 1998/09/21 02:25:23 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.162 1998/10/08 00:10:47 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -2724,18 +2724,6 @@ main(int argc, char **argv)
27242724

27252725
char *home = NULL; /* Used to store $HOME */
27262726

2727-
#ifdef WIN32
2728-
{
2729-
WSADATA wsaData;
2730-
2731-
if (WSAStartup(MAKEWORD(1, 1), &wsaData))
2732-
{
2733-
fprintf(stderr, "Failed to start winsock: %i\n", WSAGetLastError());
2734-
exit(1);
2735-
}
2736-
}
2737-
#endif
2738-
27392727
MemSet(&settings, 0, sizeof settings);
27402728
settings.opt.align = 1;
27412729
settings.opt.header = 1;

src/interfaces/libpq/libpqdll.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
11
#define WIN32_LEAN_AND_MEAN
22
#include <windows.h>
3+
#include <winsock.h>
4+
35
BOOL WINAPI
46
DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
57
LPVOID lpReserved)
68
{
9+
WSADATA wsaData;
10+
switch (fdwReason) {
11+
case DLL_PROCESS_ATTACH:
12+
if (WSAStartup(MAKEWORD(1,1),&wsaData))
13+
{
14+
/* No really good way to do error handling here,
15+
* since we don't know how we were loaded */
16+
return FALSE;
17+
}
18+
break;
19+
case DLL_PROCESS_DETACH:
20+
WSACleanup();
21+
break;
22+
}
23+
724
return TRUE;
825
}

0 commit comments

Comments
 (0)