From c9b161c04b8e6349bc2e2856c2d2d02aa03bb1f0 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 2 Apr 2012 09:29:26 +0000 Subject: -fix --- src/datastore/plugin_datastore_postgres.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/datastore/plugin_datastore_postgres.c') 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; -- cgit v1.2.3