Fix for ODBC close - Mailing list pgsql-hackers

From Bruce Momjian
Subject Fix for ODBC close
Date
Msg-id 200102100546.AAA13833@candle.pha.pa.us
Whole thread Raw
Responses Re: [PATCHES] Fix for ODBC close  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
I have applied the following patch to properly exit ODBC.  I also
patched the ODBC makefile so it links under BSD/OS.  The -Bsymbolic
under BSD/OS is very harsh under BSD/OS, requiring all symbols even in
libc and crt1.o to be resolved before creating the shared library.

My 'ld' manual says:

       -Bsymbolic
              When  creating a shared library, bind references to
              global symbols to the definition within the  shared
              library,  if  any.   Normally, it is possible for a
              program linked against a shared library to override
              the definition within the shared library.  This op-
              tion is only meaningful on ELF platforms which sup-
              port shared libraries.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
Index: src/interfaces/odbc/GNUmakefile
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/odbc/GNUmakefile,v
retrieving revision 1.8
diff -c -r1.8 GNUmakefile
*** src/interfaces/odbc/GNUmakefile    2000/12/16 18:14:25    1.8
--- src/interfaces/odbc/GNUmakefile    2001/02/10 04:25:23
***************
*** 24,30 ****
          gpps.o tuple.o tuplelist.o dlg_specific.o $(OBJX)

  SHLIB_LINK = $(filter -lm, $(LIBS))
-
  all: all-lib

  # Shared library stuff
--- 24,29 ----
***************
*** 33,39 ****
--- 32,46 ----
  # Symbols must be resolved to the version in the shared library because
  # the driver manager (e.g., iodbc) provides some symbols with the same
  # names and we don't want those.  (This issue is probably ELF specific.)
+ #
+ # BSD/OS fails with libc and crt1.o undefined symbols without this.
+ # bjm 2001-02-09
+ #
+ ifneq ($(PORTNAME), bsdi)
  LINK.shared += $(shlib_symbolic)
+ endif

  odbc_headers = isql.h isqlext.h iodbc.h
  odbc_includedir = $(includedir)/iodbc
Index: src/interfaces/odbc/socket.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/odbc/socket.c,v
retrieving revision 1.7
diff -c -r1.7 socket.c
*** src/interfaces/odbc/socket.c    2000/05/27 03:35:14    1.7
--- src/interfaces/odbc/socket.c    2001/02/10 04:25:29
***************
*** 1,4 ****
-
  /* Module:          socket.c
   *
   * Description:     This module contains functions for low level socket
--- 1,3 ----
***************
*** 78,84 ****
--- 77,87 ----
  {
      if (self->socket != -1) {
          if ( ! shutdown(self->socket, 2)) /* no sends or receives */
+         {
+             SOCK_put_char(self, 'X');
+             SOCK_flush_output(self);
              closesocket(self->socket);
+         }
      }

      if (self->buffer_in)

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Re: [DOCS] Open 7.1 items
Next
From: Tom Lane
Date:
Subject: Re: Open 7.1 items