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

Skip to content

Commit 091a765

Browse files
committed
Don't refer to odbcinst.ini by absolute path. SQLGetPrivateProfileString
handles this. Don't install our own odbcinst.ini. That's the driver manager's business.
1 parent bb2bf2d commit 091a765

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

src/interfaces/odbc/GNUmakefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# GNUMakefile for psqlodbc (Postgres ODBC driver)
44
#
5-
# $Header: /cvsroot/pgsql/src/interfaces/odbc/Attic/GNUmakefile,v 1.20 2001/09/22 22:54:32 petere Exp $
5+
# $Header: /cvsroot/pgsql/src/interfaces/odbc/Attic/GNUmakefile,v 1.21 2001/09/23 13:32:24 petere Exp $
66
#
77
#-------------------------------------------------------------------------
88

@@ -19,7 +19,7 @@ endif
1919
SO_MAJOR_VERSION = 0
2020
SO_MINOR_VERSION = 27
2121

22-
override CPPFLAGS := -I$(srcdir) $(CPPFLAGS) -DODBCINSTDIR='"$(odbcinst_ini_dir)"'
22+
override CPPFLAGS := -I$(srcdir) $(CPPFLAGS)
2323

2424

2525
OBJS = info.o bind.o columninfo.o connection.o convert.o drvconn.o \
@@ -40,6 +40,7 @@ SHLIB_LINK += -liodbcinst
4040
endif
4141
ifeq ($(with_unixodbc)$(with_iodbc),nono)
4242
OBJS += gpps.o
43+
override CPPFLAGS += -DODBCINSTDIR='"$(odbcinst_ini_dir)"'
4344
endif
4445

4546
all: all-lib
@@ -54,16 +55,14 @@ LINK.shared += $(shlib_symbolic)
5455

5556

5657
install: all installdirs
57-
$(INSTALL_DATA) $(srcdir)/odbcinst.ini $(DESTDIR)$(odbcinst_ini_dir)/odbcinst.ini
5858
$(INSTALL_DATA) $(srcdir)/odbc.sql $(DESTDIR)$(datadir)/odbc.sql
5959
$(MAKE) install-lib
6060

6161
installdirs:
62-
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(odbcinst_ini_dir) $(DESTDIR)$(datadir)
62+
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(datadir)
6363

6464
uninstall: uninstall-lib
6565
rm -f $(DESTDIR)$(datadir)/odbc.sql
66-
# XXX Uninstall the .ini file as well?
6766

6867
clean distclean maintainer-clean: clean-lib
6968
rm -f $(OBJS)

src/interfaces/odbc/dlg_specific.h

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,14 @@
2222
#define UNKNOWNS_AS_DONTKNOW 1
2323
#define UNKNOWNS_AS_LONGEST 2
2424

25-
/* INI File Stuff */
25+
/* ODBC initialization files */
2626
#ifndef WIN32
2727
#define ODBC_INI ".odbc.ini"
28-
#ifdef ODBCINSTDIR
29-
#define ODBCINST_INI ODBCINSTDIR "/odbcinst.ini"
28+
#define ODBCINST_INI "odbcinst.ini"
3029
#else
31-
#define ODBCINST_INI "/etc/odbcinst.ini"
30+
#define ODBC_INI "ODBC.INI"
31+
#define ODBCINST_INI "ODBCINST.INI"
3232
#endif
33-
#else /* WIN32 */
34-
#define ODBC_INI "ODBC.INI" /* ODBC initialization
35-
* file */
36-
#define ODBCINST_INI "ODBCINST.INI" /* ODBC Installation
37-
* file */
38-
#endif /* WIN32 */
3933

4034

4135
#define INI_DSN DBMS_NAME /* Name of default

src/interfaces/odbc/gpps.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,16 @@
4343
#define FALSE ((BOOL)0)
4444
#endif
4545

46+
#ifndef ODBCINSTDIR
47+
#error "ODBCINSTDIR must be defined to compile this file"
48+
#endif
49+
4650

4751
/*
4852
* theIniFileName is searched for in:
4953
* $HOME/theIniFileName
5054
* theIniFileName
51-
* ODBCINST_INI
55+
* ODBCINSTDIR/ODBCINST_INI
5256
*/
5357
DWORD
5458
GetPrivateProfileString(const char *theSection, /* section name */
@@ -102,7 +106,7 @@ GetPrivateProfileString(const char *theSection, /* section name */
102106
{
103107
aFile = (FILE *) fopen(theIniFileName, PG_BINARY_R);
104108
if (!aFile)
105-
aFile = (FILE *) fopen(ODBCINST_INI, PG_BINARY_R);
109+
aFile = (FILE *) fopen(ODBCINSTDIR "/" ODBCINST_INI, PG_BINARY_R);
106110
}
107111

108112
aLength = (theDefault == NULL) ? 0 : strlen(theDefault);

0 commit comments

Comments
 (0)