From: Christian Grothoff Date: Mon, 2 Apr 2012 09:29:26 +0000 (+0000) Subject: -fix X-Git-Tag: initial-import-from-subversion-38251~14032 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c9b161c04b8e6349bc2e2856c2d2d02aa03bb1f0;p=oweals%2Fgnunet.git -fix --- diff --git a/src/datastore/Makefile.am b/src/datastore/Makefile.am index 9443e52be..e7bccbc06 100644 --- a/src/datastore/Makefile.am +++ b/src/datastore/Makefile.am @@ -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 diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c index bbbbf9534..6dec3146d 100644 --- a/src/datastore/plugin_datastore_postgres.c +++ b/src/datastore/plugin_datastore_postgres.c @@ -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;