Changeset: 2b2ed0e284d6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2b2ed0e284d6
Modified Files:
        monetdb5/mal/mal.c
        tools/mserver/mserver5.c
Branch: default
Log Message:

Check that run time library is compatible with compile time.


diffs (52 lines):

diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c
--- a/monetdb5/mal/mal.c
+++ b/monetdb5/mal/mal.c
@@ -59,6 +59,18 @@ mal_init(char *modules[], int embedded)
  */
        str err;
 
+       /* check that library that we're linked against is compatible with
+        * the one we were compiled with */
+       int maj, min, patch;
+       const char *version = GDKlibversion();
+       sscanf(version, "%d.%d.%d", &maj, &min, &patch);
+       if (maj != GDK_VERSION_MAJOR || min < GDK_VERSION_MINOR) {
+               TRC_CRITICAL(MAL_SERVER, "Linked GDK library not compatible 
with the one this was compiled with\n");
+               TRC_CRITICAL(MAL_SERVER, "Linked version: %s, compiled version: 
%s\n",
+                                        version, GDK_VERSION);
+               return -1;
+       }
+
        if ((err = AUTHinitTables(NULL)) != MAL_SUCCEED) {
                freeException(err);
                return -1;
diff --git a/tools/mserver/mserver5.c b/tools/mserver/mserver5.c
--- a/tools/mserver/mserver5.c
+++ b/tools/mserver/mserver5.c
@@ -217,6 +217,26 @@ absolute_path(str s)
 static int
 monet_init(opt *set, int setlen, bool embedded)
 {
+       /* check that library that we're linked against is compatible with
+        * the one we were compiled with */
+       int maj, min, patch;
+       const char *version = GDKlibversion();
+       sscanf(version, "%d.%d.%d", &maj, &min, &patch);
+       if (maj != GDK_VERSION_MAJOR || min < GDK_VERSION_MINOR) {
+               fprintf(stderr, "Linked GDK library not compatible with the one 
this was compiled with\n");
+               fprintf(stderr, "Linked version: %s, compiled version: %s\n",
+                               version, GDK_VERSION);
+               return 0;
+       }
+       version = mal_version();
+       sscanf(version, "%d.%d.%d", &maj, &min, &patch);
+       if (maj != MONETDB5_VERSION_MAJOR || min < MONETDB5_VERSION_MINOR) {
+               fprintf(stderr, "Linked MonetDB5 library not compatible with 
the one this was compiled with\n");
+               fprintf(stderr, "Linked version: %s, compiled version: %s\n",
+                               version, MONETDB5_VERSION);
+               return 0;
+       }
+
        /* determine Monet's kernel settings */
        if (GDKinit(set, setlen, embedded) != GDK_SUCCEED)
                return 0;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to