aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-06-23 16:05:07 +0200
committerChristian Grothoff <christian@grothoff.org>2017-06-23 16:05:07 +0200
commit2cc0ab3717d0193af0a8b5be4aa367ae1874a812 (patch)
tree7c7637fdf2ecc8433fab6c60270be6a01a55ac43
parent4d9f7493cf96f560a853d2fbe34e7eee2065145d (diff)
downloadgnunet-2cc0ab3717d0193af0a8b5be4aa367ae1874a812.tar.gz
gnunet-2cc0ab3717d0193af0a8b5be4aa367ae1874a812.zip
fix misc namestore crashes from pq migration
-rw-r--r--src/namestore/gnunet-service-namestore.c7
-rw-r--r--src/namestore/namestore_api.c13
-rw-r--r--src/namestore/plugin_namestore_postgres.c4
-rw-r--r--src/zonemaster/gnunet-service-zonemaster.c3
4 files changed, 17 insertions, 10 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index 6cb4290a0..b27cfb732 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -414,9 +414,12 @@ get_nick_record (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone)
414 struct GNUNET_GNSRECORD_Data *nick; 414 struct GNUNET_GNSRECORD_Data *nick;
415 int res; 415 int res;
416 416
417 res = GSN_database->lookup_records (GSN_database->cls, zone, 417 nick = NULL;
418 res = GSN_database->lookup_records (GSN_database->cls,
419 zone,
418 GNUNET_GNS_MASTERZONE_STR, 420 GNUNET_GNS_MASTERZONE_STR,
419 &lookup_nick_it, &nick); 421 &lookup_nick_it,
422 &nick);
420 if ( (GNUNET_OK != res) || 423 if ( (GNUNET_OK != res) ||
421 (NULL == nick) ) 424 (NULL == nick) )
422 { 425 {
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c
index 933ba7b95..92068cc01 100644
--- a/src/namestore/namestore_api.c
+++ b/src/namestore/namestore_api.c
@@ -1303,11 +1303,14 @@ GNUNET_NAMESTORE_zone_iteration_stop (struct GNUNET_NAMESTORE_ZoneIterator *it)
1303 1303
1304 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1304 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1305 "Sending ZONE_ITERATION_STOP message\n"); 1305 "Sending ZONE_ITERATION_STOP message\n");
1306 env = GNUNET_MQ_msg (msg, 1306 if (NULL != h->mq)
1307 GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP); 1307 {
1308 msg->gns_header.r_id = htonl (it->op_id); 1308 env = GNUNET_MQ_msg (msg,
1309 GNUNET_MQ_send (h->mq, 1309 GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP);
1310 env); 1310 msg->gns_header.r_id = htonl (it->op_id);
1311 GNUNET_MQ_send (h->mq,
1312 env);
1313 }
1311 free_ze (it); 1314 free_ze (it);
1312} 1315}
1313 1316
diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c
index c2ea3d0a6..491cec1cb 100644
--- a/src/namestore/plugin_namestore_postgres.c
+++ b/src/namestore/plugin_namestore_postgres.c
@@ -229,7 +229,7 @@ namestore_postgres_store_records (void *cls,
229 res = GNUNET_PQ_eval_prepared_non_select (plugin->dbh, 229 res = GNUNET_PQ_eval_prepared_non_select (plugin->dbh,
230 "store_records", 230 "store_records",
231 params); 231 params);
232 if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS != res) 232 if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != res)
233 return GNUNET_SYSERR; 233 return GNUNET_SYSERR;
234 } 234 }
235 return GNUNET_OK; 235 return GNUNET_OK;
@@ -372,7 +372,7 @@ namestore_postgres_lookup_records (void *cls,
372 params, 372 params,
373 &parse_result_call_iterator, 373 &parse_result_call_iterator,
374 &pc); 374 &pc);
375 if (res < 0) 375 if (res <= 0)
376 return GNUNET_SYSERR; 376 return GNUNET_SYSERR;
377 return GNUNET_OK; 377 return GNUNET_OK;
378} 378}
diff --git a/src/zonemaster/gnunet-service-zonemaster.c b/src/zonemaster/gnunet-service-zonemaster.c
index 08a09de34..b3a2cb8b3 100644
--- a/src/zonemaster/gnunet-service-zonemaster.c
+++ b/src/zonemaster/gnunet-service-zonemaster.c
@@ -648,7 +648,8 @@ handle_monitor_event (void *cls,
648static void 648static void
649monitor_sync_event (void *cls) 649monitor_sync_event (void *cls)
650{ 650{
651 GNUNET_assert (NULL == zone_publish_task); 651 if ( (NULL == zone_publish_task) &&
652 (NULL == namestore_iter) )
652 zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start, 653 zone_publish_task = GNUNET_SCHEDULER_add_now (&publish_zone_dht_start,
653 NULL); 654 NULL);
654} 655}