-fix
authorChristian Grothoff <christian@grothoff.org>
Mon, 2 Apr 2012 09:29:26 +0000 (09:29 +0000)
committerChristian Grothoff <christian@grothoff.org>
Mon, 2 Apr 2012 09:29:26 +0000 (09:29 +0000)
src/datastore/Makefile.am
src/datastore/plugin_datastore_postgres.c

index 9443e52be35f95d4ab6d5a5b0f51a56481a2c939..e7bccbc0619b3c9e863ec2df476e9f2f0c3e5996 100644 (file)
@@ -112,6 +112,7 @@ libgnunet_plugin_datastore_postgres_la_SOURCES = \
   plugin_datastore_postgres.c
 libgnunet_plugin_datastore_postgres_la_LIBADD = \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
+  $(top_builddir)/src/postgres/libgnunetpostgres.la \
   $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lpq
 libgnunet_plugin_datastore_postgres_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS) $(POSTGRES_LDFLAGS) -lpq
index bbbbf9534da9d1e21d15258141bf381a92a7f327..6dec3146d4df10118dd65870642460428cb046cd 100644 (file)
@@ -236,13 +236,18 @@ postgres_plugin_estimate_size (void *cls)
   {
     return 0;
   }
-  if ((PQntuples (ret) != 1) || (PQnfields (ret) != 1) ||
-      (PQgetlength (ret, 0, 0) != sizeof (unsigned long long)))
+  if ((PQntuples (ret) != 1) || (PQnfields (ret) != 1) )
   {
     GNUNET_break (0);
     PQclear (ret);
     return 0;
   }
+  if (PQgetlength (ret, 0, 0) != sizeof (unsigned long long))
+  {
+    GNUNET_break (0 == PQgetlength (ret, 0, 0));
+    PQclear (ret);
+    return 0;
+  }
   total = GNUNET_ntohll (*(const unsigned long long *) PQgetvalue (ret, 0, 0));
   PQclear (ret);
   return total;