INN commit: trunk/storage/ovsqlite (ovsqlite-server.c sqlite-helper.c)

INN Commit rra at isc.org
Mon Jan 4 10:48:29 UTC 2021


    Date: Monday, January 4, 2021 @ 02:48:29
  Author: iulius
Revision: 10487

ovsqlite: fix build with SQLite 3.8.2

sqlite3_malloc64() was defined only in SQLite 3.8.7.  Switch its calls
to sqlite3_malloc().  As they allocate an error message buffer, it is
safe to assume that the size won't exceed INT_MAX.

Also silent a gcc warning with a "return 0" at the end of the main
function of ovsqlite-server.

Thanks to Bo Lindbergh for the patch.

Modified:
  trunk/storage/ovsqlite/ovsqlite-server.c
  trunk/storage/ovsqlite/sqlite-helper.c

-------------------+
 ovsqlite-server.c |    1 +
 sqlite-helper.c   |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

Modified: ovsqlite-server.c
===================================================================
--- ovsqlite-server.c	2021-01-04 10:07:33 UTC (rev 10486)
+++ ovsqlite-server.c	2021-01-04 10:48:29 UTC (rev 10487)
@@ -2162,6 +2162,7 @@
     close_db();
     if (pidfile)
         unlink(pidfile);
+    return 0;
 }
 
 #else /* ! HAVE_SQLITE3 */

Modified: sqlite-helper.c
===================================================================
--- sqlite-helper.c	2021-01-04 10:07:33 UTC (rev 10486)
+++ sqlite-helper.c	2021-01-04 10:48:29 UTC (rev 10487)
@@ -63,7 +63,7 @@
             size_t errlen;
 
             errlen = strlen(err);
-            errcopy = sqlite3_malloc64(namelen+errlen+3);
+            errcopy = sqlite3_malloc(namelen+errlen+3);
             if (errcopy) {
                 memcpy(errcopy, name, namelen);
                 errcopy[namelen]=':';
@@ -71,7 +71,7 @@
                 memcpy(errcopy+namelen+2, err, errlen+1);
             }
         } else {
-            errcopy = sqlite3_malloc64(namelen+1);
+            errcopy = sqlite3_malloc(namelen+1);
             if (errcopy)
                 memcpy(errcopy, name, namelen+1);
         }



More information about the inn-committers mailing list