commit 11a15c2e59525b33c1f3957af470a0a5d69cbd7a
Author: Tom Lane <tgl(a)redhat.com>
Date: Tue Aug 31 17:15:39 2010 -0400
Fix isql crash at EOF with -b option.
isql-fixes.patch | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
unixODBC.spec | 8 +++++-
2 files changed, 77 insertions(+), 1 deletions(-)
---
diff --git a/isql-fixes.patch b/isql-fixes.patch
new file mode 100644
index 0000000..f7026c9
--- /dev/null
+++ b/isql-fixes.patch
@@ -0,0 +1,70 @@
+Back-patch assorted fixes in isql.c from 2.3.0; notably, remove duplicate
+variable declarations that caused bug #628909, and fix some potential
+64-bit portability problems.
+
+
+diff -Naur unixODBC-2.2.14.orig/exe/isql.c unixODBC-2.2.14/exe/isql.c
+--- unixODBC-2.2.14.orig/exe/isql.c 2008-06-16 07:03:43.000000000 -0400
++++ unixODBC-2.2.14/exe/isql.c 2010-08-31 14:30:26.912367399 -0400
+@@ -243,9 +243,6 @@
+ }
+ else
+ {
+- char *line;
+- int malloced;
+-
+ line = fgets( line_buffer, line_buffer_size, stdin );
+ if ( !line ) /* EOF - ctrl D */
+ {
+@@ -300,7 +297,7 @@
+ exec_now = 1;
+ len --;
+ }
+- else if ( len == 2 && memcmp( line, "go", 2 ) == 0 )
++ else if ( len == 3 && memcmp( line, "go", 2 ) == 0 )
+ {
+ exec_now = 1;
+ dont_copy = 1;
+@@ -867,7 +864,7 @@
+ }
+ }
+
+- if ( SQLPrepare( hStmt, (SQLCHAR*)szSQL, SQL_NTS ) != SQL_SUCCESS )
++ if ( SQLPrepare( hStmt, (SQLCHAR*)szSQL, strlen( szSQL )) != SQL_SUCCESS )
+ {
+ if ( bVerbose ) DumpODBCLog( hEnv, hDbc, hStmt );
+ fprintf( stderr, "[ISQL]ERROR: Could not SQLPrepare\n" );
+@@ -1364,10 +1361,10 @@
+
+ /* HDR */
+ sret = sprintf( (char*)szColumn, "| %-*.*s",
+- nOptimalDisplayWidth, nOptimalDisplayWidth, szColumnName );
++ (int)nOptimalDisplayWidth, (int)nOptimalDisplayWidth,
szColumnName );
+ if (sret < 0)
+ sprintf((char *)szColumn, "| %-*.*s",
+- nOptimalDisplayWidth, nOptimalDisplayWidth, "**ERROR**");
++ (int)nOptimalDisplayWidth, (int)nOptimalDisplayWidth,
"**ERROR**");
+ strcat( (char*)szHdrLine,(char*) szColumn );
+ }
+ strcat((char*) szSepLine, "+\n" );
+@@ -1413,9 +1410,9 @@
+ if ( nReturn == SQL_SUCCESS && nIndicator != SQL_NULL_DATA )
+ {
+ sret = sprintf( (char*)szColumn, "| %-*.*s",
+- nOptimalDisplayWidth, nOptimalDisplayWidth,
szColumnValue );
++ (int)nOptimalDisplayWidth, (int)nOptimalDisplayWidth,
szColumnValue );
+ if (sret < 0) sprintf( (char*)szColumn, "| %-*.*s",
+- nOptimalDisplayWidth, nOptimalDisplayWidth,
"**ERROR**" );
++ (int)nOptimalDisplayWidth,
(int)nOptimalDisplayWidth, "**ERROR**" );
+
+ }
+ else if ( nReturn == SQL_ERROR )
+@@ -1424,7 +1421,7 @@
+ }
+ else
+ {
+- sprintf( (char*)szColumn, "| %-*s", nOptimalDisplayWidth,
"" );
++ sprintf( (char*)szColumn, "| %-*s", (int)nOptimalDisplayWidth,
"" );
+ }
+ fputs( (char*)szColumn, stdout );
+ } /* for columns */
diff --git a/unixODBC.spec b/unixODBC.spec
index d9d6947..112cf1b 100644
--- a/unixODBC.spec
+++ b/unixODBC.spec
@@ -1,7 +1,7 @@
Summary: A complete ODBC driver manager for Linux
Name: unixODBC
Version: 2.2.14
-Release: 11%{?dist}
+Release: 12%{?dist}
Group: System Environment/Libraries
URL:
http://www.unixODBC.org/
# Programs are GPL, libraries are LGPL, except News Server library is GPL.
@@ -21,6 +21,7 @@ Patch8: so-version-bump.patch
Patch9: keep-typedefs.patch
Patch10: odbcint64-config.patch
Patch11: enable-items.patch
+Patch12: isql-fixes.patch
Conflicts: iodbc
BuildRequires: libX11-devel libXt-devel libXext-devel
@@ -64,6 +65,7 @@ This package contains components for the ODBCConfig
%patch9 -p1
%patch10 -p1
%patch11 -p1
+%patch12 -p1
chmod 0644 Drivers/MiniSQL/*.c
chmod 0644 Drivers/nn/*.c
@@ -189,6 +191,10 @@ rm -rf $RPM_BUILD_ROOT
%postun -p /sbin/ldconfig
%changelog
+* Tue Aug 31 2010 Tom Lane <tgl(a)redhat.com> 2.2.14-12
+- Fix isql crash at EOF with -b option
+Resolves: #628909
+
* Mon May 3 2010 Tom Lane <tgl(a)redhat.com> 2.2.14-11
- Re-add accidentally-removed desktop icon for ODBCConfig
Related: #587933