[141004] trunk/base/src/cregistry/sql.c

raimue at macports.org raimue at macports.org
Wed Oct 7 12:48:25 PDT 2015


Revision: 141004
          https://trac.macports.org/changeset/141004
Author:   raimue at macports.org
Date:     2015-10-07 12:48:25 -0700 (Wed, 07 Oct 2015)
Log Message:
-----------
cregistry: abort if registry version is newer than expected

Modified Paths:
--------------
    trunk/base/src/cregistry/sql.c

Modified: trunk/base/src/cregistry/sql.c
===================================================================
--- trunk/base/src/cregistry/sql.c	2015-10-07 19:31:19 UTC (rev 141003)
+++ trunk/base/src/cregistry/sql.c	2015-10-07 19:48:25 UTC (rev 141004)
@@ -584,8 +584,17 @@
          *    already been started for you
          *  - end your query list with "COMMIT", NULL
          *  - set did_update = 1 and continue;
+         *  - update the current version number below
          */
 
+        if (sql_version(NULL, -1, version, -1, "1.202") > 0) {
+            /* the registry was already upgraded to a newer version and cannot be used anymore */
+            reg_throw(errPtr, REG_INVALID, "Version number in metadata table is newer than expected.");
+            sqlite3_finalize(stmt);
+            rollback_db(db);
+            return 0;
+        }
+
         /* if we arrive here, no update was done and we should end the
          * transaction. Using ROLLBACK here causes problems when rolling back
          * other transactions later in the program. */
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20151007/a9f6472d/attachment.html>


More information about the macports-changes mailing list