aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.1st3
-rw-r--r--configure.ac10
-rw-r--r--src/cadet/cadet_api.c3
-rw-r--r--src/curl/curl.c3
-rw-r--r--src/datacache/plugin_datacache_postgres.c8
-rw-r--r--src/dns/dnsparser.c28
-rw-r--r--src/fs/fs_dirmetascan.c29
-rw-r--r--src/gns/gnunet-service-gns_resolver.c28
-rw-r--r--src/include/gnunet_set_service.h3
-rw-r--r--src/jsonapi/test_jsonapi.c36
-rw-r--r--src/multicast/gnunet-service-multicast.c1
-rw-r--r--src/regex/regex_internal_dht.c29
-rw-r--r--src/revocation/gnunet-service-revocation.c9
-rw-r--r--src/testbed/gnunet-daemon-testbed-blacklist.c4
-rw-r--r--src/transport/plugin_transport_tcp.c6
-rw-r--r--src/transport/plugin_transport_udp.c5
-rw-r--r--src/util/disk.c27
-rw-r--r--src/util/getopt_helpers.c79
-rw-r--r--src/util/gnunet-config.c61
-rw-r--r--src/util/gnunet-ecc.c35
-rw-r--r--src/util/gnunet-resolver.c30
-rw-r--r--src/util/gnunet-service-resolver.c10
-rw-r--r--src/util/network.c7
-rw-r--r--src/util/os_installation.c23
-rw-r--r--src/util/os_priority.c1
-rw-r--r--src/util/peer.c3
-rw-r--r--src/util/program.c1
-rw-r--r--src/util/resolver_api.c15
-rw-r--r--src/util/scheduler.c47
-rw-r--r--src/util/service.c4
-rw-r--r--src/util/speedup.c1
-rw-r--r--src/util/strings.c10
-rw-r--r--src/vpn/gnunet-helper-vpn.c1
33 files changed, 376 insertions, 184 deletions
diff --git a/README.1st b/README.1st
index 19880de63..a0b3b34f0 100644
--- a/README.1st
+++ b/README.1st
@@ -95,6 +95,9 @@ notify a mobile peer about a location change and then systematically
95change the public key we use depending on our location. [6-12 PM, 95change the public key we use depending on our location. [6-12 PM,
96privacy] 96privacy]
97 97
98* Core should support protocol versioning for higher-level services
99[3 PM]
100
98 101
99cadet: 102cadet:
100* needs more systematic testing, ideally with a mock up of DHT 103* needs more systematic testing, ideally with a mock up of DHT
diff --git a/configure.ac b/configure.ac
index 017b4836c..68922e6c0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -446,7 +446,7 @@ AC_CHECK_LIB(ogg, ogg_stream_flush_fill,
446 ogg=0) 446 ogg=0)
447 447
448 448
449PKG_CHECK_MODULES([GLIB], [glib-2.0]) 449PKG_CHECK_MODULES([GLIB], [glib-2.0],
450# check for pbc library 450# check for pbc library
451pbc=0 451pbc=0
452AC_CHECK_HEADER([pbc/pbc.h],pbc=1) 452AC_CHECK_HEADER([pbc/pbc.h],pbc=1)
@@ -465,8 +465,12 @@ then
465else 465else
466 AC_DEFINE([HAVE_ABE],[0],[Lacking ABE library]) 466 AC_DEFINE([HAVE_ABE],[0],[Lacking ABE library])
467fi 467fi
468 468,
469 469# glib-2 not found
470 AM_CONDITIONAL(HAVE_PBC, [0])
471 AM_CONDITIONAL(HAVE_ABE, [0])
472 AC_DEFINE([HAVE_PBC],[0],[Lacking glib library])
473)
470 474
471gst=0 475gst=0
472PKG_CHECK_MODULES( 476PKG_CHECK_MODULES(
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c
index 497c9a4f0..6b07ab7b7 100644
--- a/src/cadet/cadet_api.c
+++ b/src/cadet/cadet_api.c
@@ -491,7 +491,7 @@ cadet_mq_send_impl (struct GNUNET_MQ_Handle *mq,
491 struct GNUNET_CADET_Handle *h = ch->cadet; 491 struct GNUNET_CADET_Handle *h = ch->cadet;
492 uint16_t msize; 492 uint16_t msize;
493 struct GNUNET_MQ_Envelope *env; 493 struct GNUNET_MQ_Envelope *env;
494 struct GNUNET_CADET_LocalData *cadet_msg; 494 struct GNUNET_CADET_LocalData *cadet_msg = NULL;
495 495
496 if (NULL == h->mq) 496 if (NULL == h->mq)
497 { 497 {
@@ -638,7 +638,6 @@ handle_channel_created (void *cls,
638 ch = create_channel (h, 638 ch = create_channel (h,
639 &ccn); 639 &ccn);
640 ch->peer = msg->peer; 640 ch->peer = msg->peer;
641 ch->cadet = h;
642 ch->incoming_port = port; 641 ch->incoming_port = port;
643 ch->options = ntohl (msg->opt); 642 ch->options = ntohl (msg->opt);
644 LOG (GNUNET_ERROR_TYPE_DEBUG, 643 LOG (GNUNET_ERROR_TYPE_DEBUG,
diff --git a/src/curl/curl.c b/src/curl/curl.c
index 6087cbddb..0a9fc5ffb 100644
--- a/src/curl/curl.c
+++ b/src/curl/curl.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 Copyright (C) 2014, 2015, 2016 GNUnet e.V. 3 Copyright (C) 2014, 2015, 2016, 2018 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify it under the 5 GNUnet is free software; you can redistribute it and/or modify it under the
6 terms of the GNU General Public License as published by the Free Software 6 terms of the GNU General Public License as published by the Free Software
@@ -466,6 +466,7 @@ GNUNET_CURL_perform (struct GNUNET_CURL_Context *ctx)
466 CURLINFO_PRIVATE, 466 CURLINFO_PRIVATE,
467 (char **) &job)); 467 (char **) &job));
468 GNUNET_assert (job->ctx == ctx); 468 GNUNET_assert (job->ctx == ctx);
469 response_code = 0;
469 j = download_get_result (&job->db, 470 j = download_get_result (&job->db,
470 job->easy_handle, 471 job->easy_handle,
471 &response_code); 472 &response_code);
diff --git a/src/datacache/plugin_datacache_postgres.c b/src/datacache/plugin_datacache_postgres.c
index 2fe6498a5..2c233c4c2 100644
--- a/src/datacache/plugin_datacache_postgres.c
+++ b/src/datacache/plugin_datacache_postgres.c
@@ -538,6 +538,14 @@ extract_result_cb (void *cls,
538 GNUNET_PQ_result_spec_end 538 GNUNET_PQ_result_spec_end
539 }; 539 };
540 540
541 if (GNUNET_YES !=
542 GNUNET_PQ_extract_result (result,
543 rs,
544 i))
545 {
546 GNUNET_break (0);
547 return;
548 }
541 if (0 != (path_len % sizeof (struct GNUNET_PeerIdentity))) 549 if (0 != (path_len % sizeof (struct GNUNET_PeerIdentity)))
542 { 550 {
543 GNUNET_break (0); 551 GNUNET_break (0);
diff --git a/src/dns/dnsparser.c b/src/dns/dnsparser.c
index 30d9245ff..1fe6f595f 100644
--- a/src/dns/dnsparser.c
+++ b/src/dns/dnsparser.c
@@ -1170,7 +1170,10 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p,
1170 trc = GNUNET_NO; 1170 trc = GNUNET_NO;
1171 for (i=0;i<p->num_queries;i++) 1171 for (i=0;i<p->num_queries;i++)
1172 { 1172 {
1173 ret = GNUNET_DNSPARSER_builder_add_query (tmp, sizeof (tmp), &off, &p->queries[i]); 1173 ret = GNUNET_DNSPARSER_builder_add_query (tmp,
1174 sizeof (tmp),
1175 &off,
1176 &p->queries[i]);
1174 if (GNUNET_SYSERR == ret) 1177 if (GNUNET_SYSERR == ret)
1175 return GNUNET_SYSERR; 1178 return GNUNET_SYSERR;
1176 if (GNUNET_NO == ret) 1179 if (GNUNET_NO == ret)
@@ -1182,7 +1185,10 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p,
1182 } 1185 }
1183 for (i=0;i<p->num_answers;i++) 1186 for (i=0;i<p->num_answers;i++)
1184 { 1187 {
1185 ret = add_record (tmp, sizeof (tmp), &off, &p->answers[i]); 1188 ret = add_record (tmp,
1189 sizeof (tmp),
1190 &off,
1191 &p->answers[i]);
1186 if (GNUNET_SYSERR == ret) 1192 if (GNUNET_SYSERR == ret)
1187 return GNUNET_SYSERR; 1193 return GNUNET_SYSERR;
1188 if (GNUNET_NO == ret) 1194 if (GNUNET_NO == ret)
@@ -1194,7 +1200,10 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p,
1194 } 1200 }
1195 for (i=0;i<p->num_authority_records;i++) 1201 for (i=0;i<p->num_authority_records;i++)
1196 { 1202 {
1197 ret = add_record (tmp, sizeof (tmp), &off, &p->authority_records[i]); 1203 ret = add_record (tmp,
1204 sizeof (tmp),
1205 &off,
1206 &p->authority_records[i]);
1198 if (GNUNET_SYSERR == ret) 1207 if (GNUNET_SYSERR == ret)
1199 return GNUNET_SYSERR; 1208 return GNUNET_SYSERR;
1200 if (GNUNET_NO == ret) 1209 if (GNUNET_NO == ret)
@@ -1206,7 +1215,10 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p,
1206 } 1215 }
1207 for (i=0;i<p->num_additional_records;i++) 1216 for (i=0;i<p->num_additional_records;i++)
1208 { 1217 {
1209 ret = add_record (tmp, sizeof (tmp), &off, &p->additional_records[i]); 1218 ret = add_record (tmp,
1219 sizeof (tmp),
1220 &off,
1221 &p->additional_records[i]);
1210 if (GNUNET_SYSERR == ret) 1222 if (GNUNET_SYSERR == ret)
1211 return GNUNET_SYSERR; 1223 return GNUNET_SYSERR;
1212 if (GNUNET_NO == ret) 1224 if (GNUNET_NO == ret)
@@ -1219,11 +1231,15 @@ GNUNET_DNSPARSER_pack (const struct GNUNET_DNSPARSER_Packet *p,
1219 1231
1220 if (GNUNET_YES == trc) 1232 if (GNUNET_YES == trc)
1221 dns.flags.message_truncated = 1; 1233 dns.flags.message_truncated = 1;
1222 GNUNET_memcpy (tmp, &dns, sizeof (struct GNUNET_TUN_DnsHeader)); 1234 GNUNET_memcpy (tmp,
1235 &dns,
1236 sizeof (struct GNUNET_TUN_DnsHeader));
1223 1237
1224 *buf = GNUNET_malloc (off); 1238 *buf = GNUNET_malloc (off);
1225 *buf_length = off; 1239 *buf_length = off;
1226 GNUNET_memcpy (*buf, tmp, off); 1240 GNUNET_memcpy (*buf,
1241 tmp,
1242 off);
1227 if (GNUNET_YES == trc) 1243 if (GNUNET_YES == trc)
1228 return GNUNET_NO; 1244 return GNUNET_NO;
1229 return GNUNET_OK; 1245 return GNUNET_OK;
diff --git a/src/fs/fs_dirmetascan.c b/src/fs/fs_dirmetascan.c
index 8a3e37b49..e904b9092 100644
--- a/src/fs/fs_dirmetascan.c
+++ b/src/fs/fs_dirmetascan.c
@@ -211,9 +211,9 @@ expand_tree (struct GNUNET_FS_ShareTreeItem *parent,
211 chld->short_filename[slen-1] = '\0'; 211 chld->short_filename[slen-1] = '\0';
212 chld->is_directory = is_directory; 212 chld->is_directory = is_directory;
213 if (NULL != parent) 213 if (NULL != parent)
214 GNUNET_CONTAINER_DLL_insert (parent->children_head, 214 GNUNET_CONTAINER_DLL_insert (parent->children_head,
215 parent->children_tail, 215 parent->children_tail,
216 chld); 216 chld);
217 return chld; 217 return chld;
218} 218}
219 219
@@ -259,7 +259,8 @@ process_helper_msgs (void *cls,
259 size_t left; 259 size_t left;
260 260
261#if 0 261#if 0
262 fprintf (stderr, "DMS parses %u-byte message of type %u\n", 262 fprintf (stderr,
263 "DMS parses %u-byte message of type %u\n",
263 (unsigned int) ntohs (msg->size), 264 (unsigned int) ntohs (msg->size),
264 (unsigned int) ntohs (msg->type)); 265 (unsigned int) ntohs (msg->type));
265#endif 266#endif
@@ -277,11 +278,18 @@ process_helper_msgs (void *cls,
277 filename, GNUNET_NO, 278 filename, GNUNET_NO,
278 GNUNET_FS_DIRSCANNER_FILE_START); 279 GNUNET_FS_DIRSCANNER_FILE_START);
279 if (NULL == ds->toplevel) 280 if (NULL == ds->toplevel)
281 {
280 ds->toplevel = expand_tree (ds->pos, 282 ds->toplevel = expand_tree (ds->pos,
281 filename, GNUNET_NO); 283 filename,
284 GNUNET_NO);
285 }
282 else 286 else
287 {
288 GNUNET_assert (NULL != ds->pos);
283 (void) expand_tree (ds->pos, 289 (void) expand_tree (ds->pos,
284 filename, GNUNET_NO); 290 filename,
291 GNUNET_NO);
292 }
285 return GNUNET_OK; 293 return GNUNET_OK;
286 case GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_PROGRESS_DIRECTORY: 294 case GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_PROGRESS_DIRECTORY:
287 if (filename[left-1] != '\0') 295 if (filename[left-1] != '\0')
@@ -303,7 +311,8 @@ process_helper_msgs (void *cls,
303 filename, GNUNET_YES, 311 filename, GNUNET_YES,
304 GNUNET_FS_DIRSCANNER_FILE_START); 312 GNUNET_FS_DIRSCANNER_FILE_START);
305 ds->pos = expand_tree (ds->pos, 313 ds->pos = expand_tree (ds->pos,
306 filename, GNUNET_YES); 314 filename,
315 GNUNET_YES);
307 if (NULL == ds->toplevel) 316 if (NULL == ds->toplevel)
308 ds->toplevel = ds->pos; 317 ds->toplevel = ds->pos;
309 return GNUNET_OK; 318 return GNUNET_OK;
@@ -360,11 +369,13 @@ process_helper_msgs (void *cls,
360 break; 369 break;
361 } 370 }
362 ds->progress_callback (ds->progress_callback_cls, 371 ds->progress_callback (ds->progress_callback_cls,
363 filename, GNUNET_YES, 372 filename,
373 GNUNET_YES,
364 GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED); 374 GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED);
365 if (0 < left) 375 if (0 < left)
366 { 376 {
367 ds->pos->meta = GNUNET_CONTAINER_meta_data_deserialize (end, left); 377 ds->pos->meta = GNUNET_CONTAINER_meta_data_deserialize (end,
378 left);
368 if (NULL == ds->pos->meta) 379 if (NULL == ds->pos->meta)
369 { 380 {
370 GNUNET_break (0); 381 GNUNET_break (0);
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index c58190599..e14a05d45 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -658,6 +658,8 @@ resolver_lookup_get_next_label (struct GNS_ResolverHandle *rh)
658 } 658 }
659 rh->protocol = pe->p_proto; 659 rh->protocol = pe->p_proto;
660 rh->service = se->s_port; 660 rh->service = se->s_port;
661 GNUNET_free (proto_name);
662 GNUNET_free (srv_name);
661 } 663 }
662 return ret; 664 return ret;
663} 665}
@@ -1017,6 +1019,7 @@ recursive_dns_resolution (struct GNS_ResolverHandle *rh)
1017 struct GNUNET_DNSPARSER_Packet *p; 1019 struct GNUNET_DNSPARSER_Packet *p;
1018 char *dns_request; 1020 char *dns_request;
1019 size_t dns_request_length; 1021 size_t dns_request_length;
1022 int ret;
1020 1023
1021 ac = rh->ac_tail; 1024 ac = rh->ac_tail;
1022 GNUNET_assert (NULL != ac); 1025 GNUNET_assert (NULL != ac);
@@ -1049,11 +1052,16 @@ recursive_dns_resolution (struct GNS_ResolverHandle *rh)
1049 UINT16_MAX); 1052 UINT16_MAX);
1050 p->flags.opcode = GNUNET_TUN_DNS_OPCODE_QUERY; 1053 p->flags.opcode = GNUNET_TUN_DNS_OPCODE_QUERY;
1051 p->flags.recursion_desired = 1; 1054 p->flags.recursion_desired = 1;
1052 if (GNUNET_OK != 1055 ret = GNUNET_DNSPARSER_pack (p,
1053 GNUNET_DNSPARSER_pack (p, 1024, &dns_request, &dns_request_length)) 1056 1024,
1057 &dns_request,
1058 &dns_request_length);
1059 if (GNUNET_OK != ret)
1054 { 1060 {
1055 GNUNET_break (0); 1061 GNUNET_break (0);
1056 rh->proc (rh->proc_cls, 0, NULL); 1062 rh->proc (rh->proc_cls,
1063 0,
1064 NULL);
1057 GNS_resolver_lookup_cancel (rh); 1065 GNS_resolver_lookup_cancel (rh);
1058 } 1066 }
1059 else 1067 else
@@ -1069,7 +1077,8 @@ recursive_dns_resolution (struct GNS_ResolverHandle *rh)
1069 &fail_resolution, 1077 &fail_resolution,
1070 rh); 1078 rh);
1071 } 1079 }
1072 GNUNET_free (dns_request); 1080 if (GNUNET_SYSERR != ret)
1081 GNUNET_free (dns_request);
1073 GNUNET_DNSPARSER_free_packet (p); 1082 GNUNET_DNSPARSER_free_packet (p);
1074} 1083}
1075 1084
@@ -1460,10 +1469,10 @@ handle_gns_resolution_result (void *cls,
1460 vpn_ctx->rd_data = GNUNET_malloc (vpn_ctx->rd_data_size); 1469 vpn_ctx->rd_data = GNUNET_malloc (vpn_ctx->rd_data_size);
1461 vpn_ctx->rd_count = rd_count; 1470 vpn_ctx->rd_count = rd_count;
1462 GNUNET_assert (vpn_ctx->rd_data_size == 1471 GNUNET_assert (vpn_ctx->rd_data_size ==
1463 GNUNET_GNSRECORD_records_serialize (rd_count, 1472 (size_t) GNUNET_GNSRECORD_records_serialize (rd_count,
1464 rd, 1473 rd,
1465 vpn_ctx->rd_data_size, 1474 vpn_ctx->rd_data_size,
1466 vpn_ctx->rd_data)); 1475 vpn_ctx->rd_data));
1467 vpn_ctx->vpn_request = GNUNET_VPN_redirect_to_peer (vpn_handle, 1476 vpn_ctx->vpn_request = GNUNET_VPN_redirect_to_peer (vpn_handle,
1468 af, 1477 af,
1469 ntohs (vpn->proto), 1478 ntohs (vpn->proto),
@@ -2360,7 +2369,8 @@ GNS_resolver_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *zone,
2360 uint32_t record_type, 2369 uint32_t record_type,
2361 const char *name, 2370 const char *name,
2362 enum GNUNET_GNS_LocalOptions options, 2371 enum GNUNET_GNS_LocalOptions options,
2363 GNS_ResultProcessor proc, void *proc_cls) 2372 GNS_ResultProcessor proc,
2373 void *proc_cls)
2364{ 2374{
2365 struct GNS_ResolverHandle *rh; 2375 struct GNS_ResolverHandle *rh;
2366 2376
diff --git a/src/include/gnunet_set_service.h b/src/include/gnunet_set_service.h
index a2999aebc..0c14aa945 100644
--- a/src/include/gnunet_set_service.h
+++ b/src/include/gnunet_set_service.h
@@ -530,6 +530,7 @@ GNUNET_SET_iterate (struct GNUNET_SET_Handle *set,
530 GNUNET_SET_ElementIterator iter, 530 GNUNET_SET_ElementIterator iter,
531 void *iter_cls); 531 void *iter_cls);
532 532
533
533/** 534/**
534 * Stop iteration over all elements in the given set. Can only 535 * Stop iteration over all elements in the given set. Can only
535 * be called before the iteration has "naturally" completed its 536 * be called before the iteration has "naturally" completed its
@@ -540,6 +541,7 @@ GNUNET_SET_iterate (struct GNUNET_SET_Handle *set,
540void 541void
541GNUNET_SET_iterate_cancel (struct GNUNET_SET_Handle *set); 542GNUNET_SET_iterate_cancel (struct GNUNET_SET_Handle *set);
542 543
544
543/** 545/**
544 * Create a copy of an element. The copy 546 * Create a copy of an element. The copy
545 * must be GNUNET_free-d by the caller. 547 * must be GNUNET_free-d by the caller.
@@ -550,6 +552,7 @@ GNUNET_SET_iterate_cancel (struct GNUNET_SET_Handle *set);
550struct GNUNET_SET_Element * 552struct GNUNET_SET_Element *
551GNUNET_SET_element_dup (const struct GNUNET_SET_Element *element); 553GNUNET_SET_element_dup (const struct GNUNET_SET_Element *element);
552 554
555
553/** 556/**
554 * Hash a set element. 557 * Hash a set element.
555 * 558 *
diff --git a/src/jsonapi/test_jsonapi.c b/src/jsonapi/test_jsonapi.c
index 379dab9af..36c7b5c6c 100644
--- a/src/jsonapi/test_jsonapi.c
+++ b/src/jsonapi/test_jsonapi.c
@@ -1,18 +1,18 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 (C) 2015, 2016 GNUnet e.V. 3 (C) 2015, 2016 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify it under the 5 GNUnet is free software; you can redistribute it and/or modify it under the
6 terms of the GNU General Public License as published by the Free Software 6 terms of the GNU General Public License as published by the Free Software
7 Foundation; either version 3, or (at your option) any later version. 7 Foundation; either version 3, or (at your option) any later version.
8 8
9 GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY 9 GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE. See the GNU General Public License for more details. 11 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 12
13 You should have received a copy of the GNU General Public License along with 13 You should have received a copy of the GNU General Public License along with
14 GNUnet; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> 14 GNUnet; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
15*/ 15 */
16 16
17/** 17/**
18 * @file json/test_jsonapi.c 18 * @file json/test_jsonapi.c
@@ -24,7 +24,7 @@
24#include "gnunet_jsonapi_lib.h" 24#include "gnunet_jsonapi_lib.h"
25#include "gnunet_json_lib.h" 25#include "gnunet_json_lib.h"
26 26
27#define TEST_JSONAPI_DOCUMENT "{\"data\":{\"id\":\"1\",\"type\":\"bar\",\"attributes\":{\"foo\":\"bar\"}}}" 27#define TEST_JSONAPI_DOCUMENT "{\"data\":[{\"id\":\"1\",\"type\":\"bar\",\"attributes\":{\"foo\":\"bar\"}}]}"
28 28
29#define TEST_JSONAPI_DOCUMENT_ERR "{\"errors\":[{\"id\":\"1\",\"status\":\"403\",\"code\":\"23\", \"title\":\"Error\", \"detail\":\"Error details\"}]}" 29#define TEST_JSONAPI_DOCUMENT_ERR "{\"errors\":[{\"id\":\"1\",\"status\":\"403\",\"code\":\"23\", \"title\":\"Error\", \"detail\":\"Error details\"}]}"
30 30
@@ -74,7 +74,8 @@ test_document ()
74 json_t *doc_json; 74 json_t *doc_json;
75 json_t *data_js; 75 json_t *data_js;
76 json_error_t err; 76 json_error_t err;
77 77 int ret;
78
78 obj = GNUNET_JSONAPI_document_new (); 79 obj = GNUNET_JSONAPI_document_new ();
79 res = GNUNET_JSONAPI_resource_new ("bar", 80 res = GNUNET_JSONAPI_resource_new ("bar",
80 "1"); 81 "1");
@@ -94,11 +95,11 @@ test_document ()
94 JSON_DECODE_ANY, 95 JSON_DECODE_ANY,
95 &err); 96 &err);
96 GNUNET_assert (NULL != data_js); 97 GNUNET_assert (NULL != data_js);
97 GNUNET_assert (0 != json_equal (data_js, doc_json)); 98 ret = json_equal (data_js, doc_json) ? 0 : 1;
98 GNUNET_JSONAPI_document_delete (obj); 99 GNUNET_JSONAPI_document_delete (obj);
99 json_decref (data_js); 100 json_decref (data_js);
100 json_decref (doc_json); 101 json_decref (doc_json);
101 return 0; 102 return ret;
102} 103}
103 104
104static int 105static int
@@ -106,6 +107,7 @@ test_serialize ()
106{ 107{
107 struct GNUNET_JSONAPI_Document *obj; 108 struct GNUNET_JSONAPI_Document *obj;
108 char* tmp_data; 109 char* tmp_data;
110 int ret;
109 json_t* data_js; 111 json_t* data_js;
110 json_t* tmp_data_js; 112 json_t* tmp_data_js;
111 json_error_t err; 113 json_error_t err;
@@ -125,11 +127,11 @@ test_serialize ()
125 GNUNET_JSON_parse_free (jsonapispec); 127 GNUNET_JSON_parse_free (jsonapispec);
126 tmp_data_js = json_loads (tmp_data, JSON_DECODE_ANY, &err); 128 tmp_data_js = json_loads (tmp_data, JSON_DECODE_ANY, &err);
127 GNUNET_assert (NULL != tmp_data_js); 129 GNUNET_assert (NULL != tmp_data_js);
128 GNUNET_assert (0 != json_equal (tmp_data_js, data_js)); 130 ret = (1 == json_equal (tmp_data_js, data_js)) ? 0 : 1;
129 json_decref (data_js); 131 json_decref (data_js);
130 json_decref (tmp_data_js); 132 json_decref (tmp_data_js);
131 GNUNET_free (tmp_data); 133 GNUNET_free (tmp_data);
132 return 0; 134 return ret;
133} 135}
134 136
135/** 137/**
diff --git a/src/multicast/gnunet-service-multicast.c b/src/multicast/gnunet-service-multicast.c
index ba1086cc5..d01227e2c 100644
--- a/src/multicast/gnunet-service-multicast.c
+++ b/src/multicast/gnunet-service-multicast.c
@@ -664,6 +664,7 @@ client_send_random (struct GNUNET_HashCode *pub_key_hash,
664 if (n <= 0) 664 if (n <= 0)
665 n = GNUNET_CONTAINER_multihashmap_get_random (members, client_send_member_cb, 665 n = GNUNET_CONTAINER_multihashmap_get_random (members, client_send_member_cb,
666 (void *) env); 666 (void *) env);
667 GNUNET_MQ_discard (env);
667 return n; 668 return n;
668} 669}
669 670
diff --git a/src/regex/regex_internal_dht.c b/src/regex/regex_internal_dht.c
index b80dabca0..828bb1648 100644
--- a/src/regex/regex_internal_dht.c
+++ b/src/regex/regex_internal_dht.c
@@ -154,23 +154,30 @@ regex_iterator (void *cls,
154 NULL, NULL); 154 NULL, NULL);
155 } 155 }
156 block = REGEX_BLOCK_create (proof, 156 block = REGEX_BLOCK_create (proof,
157 num_edges, edges, 157 num_edges,
158 edges,
158 accepting, 159 accepting,
159 &size); 160 &size);
160 (void) 161 if (NULL == block)
161 GNUNET_DHT_put (h->dht, key, 162 return;
162 DHT_REPLICATION, 163 (void) GNUNET_DHT_put (h->dht,
163 DHT_OPT, 164 key,
164 GNUNET_BLOCK_TYPE_REGEX, 165 DHT_REPLICATION,
165 size, block, 166 DHT_OPT,
166 GNUNET_TIME_relative_to_absolute (DHT_TTL), 167 GNUNET_BLOCK_TYPE_REGEX,
167 NULL, NULL); 168 size,
169 block,
170 GNUNET_TIME_relative_to_absolute (DHT_TTL),
171 NULL,
172 NULL);
168 GNUNET_STATISTICS_update (h->stats, 173 GNUNET_STATISTICS_update (h->stats,
169 "# regex blocks stored", 174 "# regex blocks stored",
170 1, GNUNET_NO); 175 1,
176 GNUNET_NO);
171 GNUNET_STATISTICS_update (h->stats, 177 GNUNET_STATISTICS_update (h->stats,
172 "# regex block bytes stored", 178 "# regex block bytes stored",
173 size, GNUNET_NO); 179 size,
180 GNUNET_NO);
174 GNUNET_free (block); 181 GNUNET_free (block);
175} 182}
176 183
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c
index 8281e9a16..23f654141 100644
--- a/src/revocation/gnunet-service-revocation.c
+++ b/src/revocation/gnunet-service-revocation.c
@@ -759,7 +759,11 @@ handle_revocation_union_request (void *cls,
759 { 759 {
760 peer_entry = new_peer_entry (other_peer); 760 peer_entry = new_peer_entry (other_peer);
761 } 761 }
762 GNUNET_assert (NULL == peer_entry->so); 762 if (NULL != peer_entry->so)
763 {
764 GNUNET_break_op (0);
765 return;
766 }
763 peer_entry->so = GNUNET_SET_accept (request, 767 peer_entry->so = GNUNET_SET_accept (request,
764 GNUNET_SET_RESULT_ADDED, 768 GNUNET_SET_RESULT_ADDED,
765 (struct GNUNET_SET_Option[]) {{ 0 }}, 769 (struct GNUNET_SET_Option[]) {{ 0 }},
@@ -769,8 +773,7 @@ handle_revocation_union_request (void *cls,
769 GNUNET_SET_commit (peer_entry->so, 773 GNUNET_SET_commit (peer_entry->so,
770 revocation_set)) 774 revocation_set))
771 { 775 {
772 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 776 GNUNET_break (0);
773 _("SET service crashed, terminating revocation service\n"));
774 GNUNET_SCHEDULER_shutdown (); 777 GNUNET_SCHEDULER_shutdown ();
775 return; 778 return;
776 } 779 }
diff --git a/src/testbed/gnunet-daemon-testbed-blacklist.c b/src/testbed/gnunet-daemon-testbed-blacklist.c
index f2f96ee09..3ebe20258 100644
--- a/src/testbed/gnunet-daemon-testbed-blacklist.c
+++ b/src/testbed/gnunet-daemon-testbed-blacklist.c
@@ -190,7 +190,8 @@ run (void *cls,
190 char *fname; 190 char *fname;
191 191
192 if (GNUNET_OK != 192 if (GNUNET_OK !=
193 GNUNET_CONFIGURATION_get_value_filename (c, "PATHS", 193 GNUNET_CONFIGURATION_get_value_filename (c,
194 "PATHS",
194 "GNUNET_HOME", 195 "GNUNET_HOME",
195 &shome)) 196 &shome))
196 { 197 {
@@ -208,6 +209,7 @@ run (void *cls,
208 GNUNET_free (fname); 209 GNUNET_free (fname);
209 return; 210 return;
210 } 211 }
212 GNUNET_free (fname);
211 GNUNET_asprintf (&fname, 213 GNUNET_asprintf (&fname,
212 "%s/blacklist", 214 "%s/blacklist",
213 shome); 215 shome);
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index a63013caa..5b78dc970 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -3348,7 +3348,7 @@ handle_tcp_data (void *cls,
3348 if (NULL == session) 3348 if (NULL == session)
3349 { 3349 {
3350 /* No inbound session found */ 3350 /* No inbound session found */
3351 void *vaddr; 3351 void *vaddr = NULL;
3352 size_t alen; 3352 size_t alen;
3353 3353
3354 GNUNET_SERVER_client_get_address (client, 3354 GNUNET_SERVER_client_get_address (client,
@@ -3369,7 +3369,7 @@ handle_tcp_data (void *cls,
3369 if (GNUNET_YES == session->expecting_welcome) 3369 if (GNUNET_YES == session->expecting_welcome)
3370 { 3370 {
3371 /* Session is expecting WELCOME message */ 3371 /* Session is expecting WELCOME message */
3372 void *vaddr; 3372 void *vaddr = NULL;
3373 size_t alen; 3373 size_t alen;
3374 3374
3375 GNUNET_SERVER_client_get_address (client, 3375 GNUNET_SERVER_client_get_address (client,
@@ -3389,7 +3389,7 @@ handle_tcp_data (void *cls,
3389 3389
3390 session->last_activity = GNUNET_TIME_absolute_get (); 3390 session->last_activity = GNUNET_TIME_absolute_get ();
3391 { 3391 {
3392 void *vaddr; 3392 void *vaddr = NULL;
3393 size_t alen; 3393 size_t alen;
3394 3394
3395 GNUNET_SERVER_client_get_address (client, 3395 GNUNET_SERVER_client_get_address (client,
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index 1ff962544..f214e7be4 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -1631,6 +1631,7 @@ enqueue (struct Plugin *plugin,
1631 if (GNUNET_YES == session->in_destroy) 1631 if (GNUNET_YES == session->in_destroy)
1632 { 1632 {
1633 GNUNET_break (0); 1633 GNUNET_break (0);
1634 GNUNET_free (udpw);
1634 return; 1635 return;
1635 } 1636 }
1636 if (plugin->bytes_in_buffer > INT64_MAX - udpw->msg_size) 1637 if (plugin->bytes_in_buffer > INT64_MAX - udpw->msg_size)
@@ -1913,8 +1914,8 @@ enqueue_fragment (void *cls,
1913 udpw->qc = &qc_fragment_sent; 1914 udpw->qc = &qc_fragment_sent;
1914 udpw->qc_cls = plugin; 1915 udpw->qc_cls = plugin;
1915 GNUNET_memcpy (udpw->msg_buf, 1916 GNUNET_memcpy (udpw->msg_buf,
1916 msg, 1917 msg,
1917 msg_len); 1918 msg_len);
1918 enqueue (plugin, 1919 enqueue (plugin,
1919 udpw); 1920 udpw);
1920 if (session->address->address_length == sizeof (struct IPv4UdpAddress)) 1921 if (session->address->address_length == sizeof (struct IPv4UdpAddress))
diff --git a/src/util/disk.c b/src/util/disk.c
index d536ec897..8fd689070 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -1324,6 +1324,7 @@ static int
1324remove_helper (void *unused, 1324remove_helper (void *unused,
1325 const char *fn) 1325 const char *fn)
1326{ 1326{
1327 (void) unused;
1327 (void) GNUNET_DISK_directory_remove (fn); 1328 (void) GNUNET_DISK_directory_remove (fn);
1328 return GNUNET_OK; 1329 return GNUNET_OK;
1329} 1330}
@@ -1396,6 +1397,7 @@ GNUNET_DISK_file_copy (const char *src,
1396 uint64_t pos; 1397 uint64_t pos;
1397 uint64_t size; 1398 uint64_t size;
1398 size_t len; 1399 size_t len;
1400 ssize_t sret;
1399 struct GNUNET_DISK_FileHandle *in; 1401 struct GNUNET_DISK_FileHandle *in;
1400 struct GNUNET_DISK_FileHandle *out; 1402 struct GNUNET_DISK_FileHandle *out;
1401 1403
@@ -1425,9 +1427,17 @@ GNUNET_DISK_file_copy (const char *src,
1425 len = COPY_BLK_SIZE; 1427 len = COPY_BLK_SIZE;
1426 if (len > size - pos) 1428 if (len > size - pos)
1427 len = size - pos; 1429 len = size - pos;
1428 if (len != GNUNET_DISK_file_read (in, buf, len)) 1430 sret = GNUNET_DISK_file_read (in,
1431 buf,
1432 len);
1433 if ( (sret < 0) ||
1434 (len != (size_t) sret) )
1429 goto FAIL; 1435 goto FAIL;
1430 if (len != GNUNET_DISK_file_write (out, buf, len)) 1436 sret = GNUNET_DISK_file_write (out,
1437 buf,
1438 len);
1439 if ( (sret < 0) ||
1440 (len != (size_t) sret) )
1431 goto FAIL; 1441 goto FAIL;
1432 pos += len; 1442 pos += len;
1433 } 1443 }
@@ -1457,7 +1467,8 @@ GNUNET_DISK_filename_canonicalize (char *fn)
1457 { 1467 {
1458 c = *idx; 1468 c = *idx;
1459 1469
1460 if (c == '/' || c == '\\' || c == ':' || c == '*' || c == '?' || c == '"' || 1470 if (c == '/' || c == '\\' || c == ':' ||
1471 c == '*' || c == '?' || c == '"' ||
1461 c == '<' || c == '>' || c == '|') 1472 c == '<' || c == '>' || c == '|')
1462 { 1473 {
1463 *idx = '_'; 1474 *idx = '_';
@@ -2236,18 +2247,24 @@ create_selectable_pipe (PHANDLE read_pipe_ptr, PHANDLE write_pipe_ptr,
2236 * @return handle to the new pipe, NULL on error 2247 * @return handle to the new pipe, NULL on error
2237 */ 2248 */
2238struct GNUNET_DISK_PipeHandle * 2249struct GNUNET_DISK_PipeHandle *
2239GNUNET_DISK_pipe (int blocking_read, int blocking_write, int inherit_read, int inherit_write) 2250GNUNET_DISK_pipe (int blocking_read,
2251 int blocking_write,
2252 int inherit_read,
2253 int inherit_write)
2240{ 2254{
2241#ifndef MINGW 2255#ifndef MINGW
2242 int fd[2]; 2256 int fd[2];
2243 int ret; 2257 int ret;
2244 int eno; 2258 int eno;
2245 2259
2260 (void) inherit_read;
2261 (void) inherit_write;
2246 ret = pipe (fd); 2262 ret = pipe (fd);
2247 if (ret == -1) 2263 if (ret == -1)
2248 { 2264 {
2249 eno = errno; 2265 eno = errno;
2250 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "pipe"); 2266 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR,
2267 "pipe");
2251 errno = eno; 2268 errno = eno;
2252 return NULL; 2269 return NULL;
2253 } 2270 }
diff --git a/src/util/getopt_helpers.c b/src/util/getopt_helpers.c
index c3d0e4c7c..c836c9055 100644
--- a/src/util/getopt_helpers.c
+++ b/src/util/getopt_helpers.c
@@ -46,6 +46,8 @@ print_version (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
46{ 46{
47 const char *version = scls; 47 const char *version = scls;
48 48
49 (void) option;
50 (void) value;
49 printf ("%s v%s\n", 51 printf ("%s v%s\n",
50 ctx->binaryName, 52 ctx->binaryName,
51 version); 53 version);
@@ -104,6 +106,8 @@ format_help (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
104 const struct GNUNET_GETOPT_CommandLineOption *opt; 106 const struct GNUNET_GETOPT_CommandLineOption *opt;
105 const struct GNUNET_OS_ProjectData *pd; 107 const struct GNUNET_OS_ProjectData *pd;
106 108
109 (void) option;
110 (void) value;
107 if (NULL != about) 111 if (NULL != about)
108 { 112 {
109 printf ("%s\n%s\n", ctx->binaryOptions, gettext (about)); 113 printf ("%s\n%s\n", ctx->binaryOptions, gettext (about));
@@ -112,7 +116,7 @@ format_help (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
112 } 116 }
113 i = 0; 117 i = 0;
114 opt = ctx->allOptions; 118 opt = ctx->allOptions;
115 while (opt[i].description != NULL) 119 while (NULL != opt[i].description)
116 { 120 {
117 if (opt[i].shortName == '\0') 121 if (opt[i].shortName == '\0')
118 printf (" "); 122 printf (" ");
@@ -120,7 +124,7 @@ format_help (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
120 printf (" -%c, ", opt[i].shortName); 124 printf (" -%c, ", opt[i].shortName);
121 printf ("--%s", opt[i].name); 125 printf ("--%s", opt[i].name);
122 slen = 8 + strlen (opt[i].name); 126 slen = 8 + strlen (opt[i].name);
123 if (opt[i].argumentHelp != NULL) 127 if (NULL != opt[i].argumentHelp)
124 { 128 {
125 printf ("=%s", opt[i].argumentHelp); 129 printf ("=%s", opt[i].argumentHelp);
126 slen += 1 + strlen (opt[i].argumentHelp); 130 slen += 1 + strlen (opt[i].argumentHelp);
@@ -144,7 +148,7 @@ format_help (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
144OUTER: 148OUTER:
145 while (ml - p > 78 - slen) 149 while (ml - p > 78 - slen)
146 { 150 {
147 for (j = p + 78 - slen; j > p; j--) 151 for (j = p + 78 - slen; j > (int) p; j--)
148 { 152 {
149 if (isspace ((unsigned char) trans[j])) 153 if (isspace ((unsigned char) trans[j]))
150 { 154 {
@@ -227,6 +231,9 @@ increment_value (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
227{ 231{
228 unsigned int *val = scls; 232 unsigned int *val = scls;
229 233
234 (void) ctx;
235 (void) option;
236 (void) value;
230 (*val)++; 237 (*val)++;
231 return GNUNET_OK; 238 return GNUNET_OK;
232} 239}
@@ -243,9 +250,9 @@ increment_value (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
243 */ 250 */
244struct GNUNET_GETOPT_CommandLineOption 251struct GNUNET_GETOPT_CommandLineOption
245GNUNET_GETOPT_option_increment_uint (char shortName, 252GNUNET_GETOPT_option_increment_uint (char shortName,
246 const char *name, 253 const char *name,
247 const char *description, 254 const char *description,
248 unsigned int *val) 255 unsigned int *val)
249{ 256{
250 struct GNUNET_GETOPT_CommandLineOption clo = { 257 struct GNUNET_GETOPT_CommandLineOption clo = {
251 .shortName = shortName, 258 .shortName = shortName,
@@ -302,6 +309,9 @@ set_one (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
302{ 309{
303 int *val = scls; 310 int *val = scls;
304 311
312 (void) ctx;
313 (void) option;
314 (void) value;
305 *val = 1; 315 *val = 1;
306 return GNUNET_OK; 316 return GNUNET_OK;
307} 317}
@@ -319,9 +329,9 @@ set_one (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
319 */ 329 */
320struct GNUNET_GETOPT_CommandLineOption 330struct GNUNET_GETOPT_CommandLineOption
321GNUNET_GETOPT_option_flag (char shortName, 331GNUNET_GETOPT_option_flag (char shortName,
322 const char *name, 332 const char *name,
323 const char *description, 333 const char *description,
324 int *val) 334 int *val)
325{ 335{
326 struct GNUNET_GETOPT_CommandLineOption clo = { 336 struct GNUNET_GETOPT_CommandLineOption clo = {
327 .shortName = shortName, 337 .shortName = shortName,
@@ -357,6 +367,8 @@ set_string (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
357{ 367{
358 char **val = scls; 368 char **val = scls;
359 369
370 (void) ctx;
371 (void) option;
360 GNUNET_assert (NULL != value); 372 GNUNET_assert (NULL != value);
361 GNUNET_free_non_null (*val); 373 GNUNET_free_non_null (*val);
362 *val = GNUNET_strdup (value); 374 *val = GNUNET_strdup (value);
@@ -436,6 +448,8 @@ set_filename (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
436{ 448{
437 char **val = scls; 449 char **val = scls;
438 450
451 (void) ctx;
452 (void) option;
439 GNUNET_assert (NULL != value); 453 GNUNET_assert (NULL != value);
440 GNUNET_free_non_null (*val); 454 GNUNET_free_non_null (*val);
441 *val = GNUNET_STRINGS_filename_expand (value); 455 *val = GNUNET_STRINGS_filename_expand (value);
@@ -454,10 +468,10 @@ set_filename (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
454 */ 468 */
455struct GNUNET_GETOPT_CommandLineOption 469struct GNUNET_GETOPT_CommandLineOption
456GNUNET_GETOPT_option_filename (char shortName, 470GNUNET_GETOPT_option_filename (char shortName,
457 const char *name, 471 const char *name,
458 const char *argumentHelp, 472 const char *argumentHelp,
459 const char *description, 473 const char *description,
460 char **str) 474 char **str)
461{ 475{
462 struct GNUNET_GETOPT_CommandLineOption clo = { 476 struct GNUNET_GETOPT_CommandLineOption clo = {
463 .shortName = shortName, 477 .shortName = shortName,
@@ -538,6 +552,7 @@ set_ulong (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
538{ 552{
539 unsigned long long *val = scls; 553 unsigned long long *val = scls;
540 554
555 (void) ctx;
541 if (1 != SSCANF (value, 556 if (1 != SSCANF (value,
542 "%llu", 557 "%llu",
543 val)) 558 val))
@@ -562,10 +577,10 @@ set_ulong (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
562 */ 577 */
563struct GNUNET_GETOPT_CommandLineOption 578struct GNUNET_GETOPT_CommandLineOption
564GNUNET_GETOPT_option_ulong (char shortName, 579GNUNET_GETOPT_option_ulong (char shortName,
565 const char *name, 580 const char *name,
566 const char *argumentHelp, 581 const char *argumentHelp,
567 const char *description, 582 const char *description,
568 unsigned long long *val) 583 unsigned long long *val)
569{ 584{
570 struct GNUNET_GETOPT_CommandLineOption clo = { 585 struct GNUNET_GETOPT_CommandLineOption clo = {
571 .shortName = shortName, 586 .shortName = shortName,
@@ -601,7 +616,8 @@ set_relative_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
601 const char *value) 616 const char *value)
602{ 617{
603 struct GNUNET_TIME_Relative *val = scls; 618 struct GNUNET_TIME_Relative *val = scls;
604 619
620 (void) ctx;
605 if (GNUNET_OK != 621 if (GNUNET_OK !=
606 GNUNET_STRINGS_fancy_time_to_relative (value, 622 GNUNET_STRINGS_fancy_time_to_relative (value,
607 val)) 623 val))
@@ -627,10 +643,10 @@ set_relative_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
627 */ 643 */
628struct GNUNET_GETOPT_CommandLineOption 644struct GNUNET_GETOPT_CommandLineOption
629GNUNET_GETOPT_option_relative_time (char shortName, 645GNUNET_GETOPT_option_relative_time (char shortName,
630 const char *name, 646 const char *name,
631 const char *argumentHelp, 647 const char *argumentHelp,
632 const char *description, 648 const char *description,
633 struct GNUNET_TIME_Relative *val) 649 struct GNUNET_TIME_Relative *val)
634{ 650{
635 struct GNUNET_GETOPT_CommandLineOption clo = { 651 struct GNUNET_GETOPT_CommandLineOption clo = {
636 .shortName = shortName, 652 .shortName = shortName,
@@ -667,6 +683,7 @@ set_absolute_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
667{ 683{
668 struct GNUNET_TIME_Absolute *val = scls; 684 struct GNUNET_TIME_Absolute *val = scls;
669 685
686 (void) ctx;
670 if (GNUNET_OK != 687 if (GNUNET_OK !=
671 GNUNET_STRINGS_fancy_time_to_absolute (value, 688 GNUNET_STRINGS_fancy_time_to_absolute (value,
672 val)) 689 val))
@@ -692,10 +709,10 @@ set_absolute_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
692 */ 709 */
693struct GNUNET_GETOPT_CommandLineOption 710struct GNUNET_GETOPT_CommandLineOption
694GNUNET_GETOPT_option_absolute_time (char shortName, 711GNUNET_GETOPT_option_absolute_time (char shortName,
695 const char *name, 712 const char *name,
696 const char *argumentHelp, 713 const char *argumentHelp,
697 const char *description, 714 const char *description,
698 struct GNUNET_TIME_Absolute *val) 715 struct GNUNET_TIME_Absolute *val)
699{ 716{
700 struct GNUNET_GETOPT_CommandLineOption clo = { 717 struct GNUNET_GETOPT_CommandLineOption clo = {
701 .shortName = shortName, 718 .shortName = shortName,
@@ -732,6 +749,7 @@ set_uint (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
732{ 749{
733 unsigned int *val = scls; 750 unsigned int *val = scls;
734 751
752 (void) ctx;
735 if (1 != SSCANF (value, 753 if (1 != SSCANF (value,
736 "%u", 754 "%u",
737 val)) 755 val))
@@ -756,10 +774,10 @@ set_uint (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
756 */ 774 */
757struct GNUNET_GETOPT_CommandLineOption 775struct GNUNET_GETOPT_CommandLineOption
758GNUNET_GETOPT_option_uint (char shortName, 776GNUNET_GETOPT_option_uint (char shortName,
759 const char *name, 777 const char *name,
760 const char *argumentHelp, 778 const char *argumentHelp,
761 const char *description, 779 const char *description,
762 unsigned int *val) 780 unsigned int *val)
763{ 781{
764 struct GNUNET_GETOPT_CommandLineOption clo = { 782 struct GNUNET_GETOPT_CommandLineOption clo = {
765 .shortName = shortName, 783 .shortName = shortName,
@@ -813,6 +831,7 @@ set_base32 (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
813{ 831{
814 struct Base32Context *bc = scls; 832 struct Base32Context *bc = scls;
815 833
834 (void) ctx;
816 if (GNUNET_OK != 835 if (GNUNET_OK !=
817 GNUNET_STRINGS_string_to_data (value, 836 GNUNET_STRINGS_string_to_data (value,
818 strlen (value), 837 strlen (value),
diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c
index fb3b9ebf9..5f7d9fc0d 100644
--- a/src/util/gnunet-config.c
+++ b/src/util/gnunet-config.c
@@ -72,12 +72,17 @@ static int rewrite;
72 * @param value value of the option 72 * @param value value of the option
73 */ 73 */
74static void 74static void
75print_option (void *cls, const char *section, 75print_option (void *cls,
76 const char *section,
76 const char *option, 77 const char *option,
77 const char *value) 78 const char *value)
78{ 79{
80 (void) cls;
81 (void) section;
79 fprintf (stdout, 82 fprintf (stdout,
80 "%s = %s\n", option, value); 83 "%s = %s\n",
84 option,
85 value);
81} 86}
82 87
83 88
@@ -91,7 +96,10 @@ static void
91print_section_name (void *cls, 96print_section_name (void *cls,
92 const char *section) 97 const char *section)
93{ 98{
94 fprintf (stdout, "%s\n", section); 99 (void) cls;
100 fprintf (stdout,
101 "%s\n",
102 section);
95} 103}
96 104
97 105
@@ -112,6 +120,8 @@ run (void *cls,
112 struct GNUNET_CONFIGURATION_Handle *out = NULL; 120 struct GNUNET_CONFIGURATION_Handle *out = NULL;
113 struct GNUNET_CONFIGURATION_Handle *diff = NULL; 121 struct GNUNET_CONFIGURATION_Handle *diff = NULL;
114 122
123 (void) cls;
124 (void) args;
115 if (rewrite) 125 if (rewrite)
116 { 126 {
117 struct GNUNET_CONFIGURATION_Handle *def; 127 struct GNUNET_CONFIGURATION_Handle *def;
@@ -221,36 +231,37 @@ run (void *cls,
221 * @return 0 ok, 1 on error 231 * @return 0 ok, 1 on error
222 */ 232 */
223int 233int
224main (int argc, char *const *argv) 234main (int argc,
235 char *const *argv)
225{ 236{
226 struct GNUNET_GETOPT_CommandLineOption options[] = { 237 struct GNUNET_GETOPT_CommandLineOption options[] = {
227 GNUNET_GETOPT_option_flag ('f', 238 GNUNET_GETOPT_option_flag ('f',
228 "filename", 239 "filename",
229 gettext_noop ("obtain option of value as a filename (with $-expansion)"), 240 gettext_noop ("obtain option of value as a filename (with $-expansion)"),
230 &is_filename), 241 &is_filename),
231 GNUNET_GETOPT_option_string ('s', 242 GNUNET_GETOPT_option_string ('s',
232 "section", 243 "section",
233 "SECTION", 244 "SECTION",
234 gettext_noop ("name of the section to access"), 245 gettext_noop ("name of the section to access"),
235 &section), 246 &section),
236 GNUNET_GETOPT_option_string ('o', 247 GNUNET_GETOPT_option_string ('o',
237 "option", 248 "option",
238 "OPTION", 249 "OPTION",
239 gettext_noop ("name of the option to access"), 250 gettext_noop ("name of the option to access"),
240 &option), 251 &option),
241 GNUNET_GETOPT_option_string ('V', 252 GNUNET_GETOPT_option_string ('V',
242 "value", 253 "value",
243 "VALUE", 254 "VALUE",
244 gettext_noop ("value to set"), 255 gettext_noop ("value to set"),
245 &value), 256 &value),
246 GNUNET_GETOPT_option_flag ('S', 257 GNUNET_GETOPT_option_flag ('S',
247 "list-sections", 258 "list-sections",
248 gettext_noop ("print available configuration sections"), 259 gettext_noop ("print available configuration sections"),
249 &list_sections), 260 &list_sections),
250 GNUNET_GETOPT_option_flag ('w', 261 GNUNET_GETOPT_option_flag ('w',
251 "rewrite", 262 "rewrite",
252 gettext_noop ("write configuration file that only contains delta to defaults"), 263 gettext_noop ("write configuration file that only contains delta to defaults"),
253 &rewrite), 264 &rewrite),
254 GNUNET_GETOPT_OPTION_END 265 GNUNET_GETOPT_OPTION_END
255 }; 266 };
256 if (GNUNET_OK != 267 if (GNUNET_OK !=
diff --git a/src/util/gnunet-ecc.c b/src/util/gnunet-ecc.c
index 66a4bd3e9..59a100a8c 100644
--- a/src/util/gnunet-ecc.c
+++ b/src/util/gnunet-ecc.c
@@ -281,8 +281,10 @@ print_key (const char *filename)
281 uint64_t fs; 281 uint64_t fs;
282 unsigned int total_hostkeys; 282 unsigned int total_hostkeys;
283 unsigned int c; 283 unsigned int c;
284 ssize_t sret;
284 285
285 if (GNUNET_YES != GNUNET_DISK_file_test (filename)) 286 if (GNUNET_YES !=
287 GNUNET_DISK_file_test (filename))
286 { 288 {
287 fprintf (stderr, 289 fprintf (stderr,
288 _("Hostkeys file `%s' not found\n"), 290 _("Hostkeys file `%s' not found\n"),
@@ -291,7 +293,11 @@ print_key (const char *filename)
291 } 293 }
292 294
293 /* Check hostkey file size, read entire thing into memory */ 295 /* Check hostkey file size, read entire thing into memory */
294 if (GNUNET_OK != GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES)) 296 if (GNUNET_OK !=
297 GNUNET_DISK_file_size (filename,
298 &fs,
299 GNUNET_YES,
300 GNUNET_YES))
295 fs = 0; 301 fs = 0;
296 if (0 == fs) 302 if (0 == fs)
297 { 303 {
@@ -307,15 +313,22 @@ print_key (const char *filename)
307 filename); 313 filename);
308 return; 314 return;
309 } 315 }
310 fd = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ, 316 fd = GNUNET_DISK_file_open (filename,
311 GNUNET_DISK_PERM_NONE); 317 GNUNET_DISK_OPEN_READ,
318 GNUNET_DISK_PERM_NONE);
312 if (NULL == fd) 319 if (NULL == fd)
313 { 320 {
314 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open", filename); 321 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
322 "open",
323 filename);
315 return; 324 return;
316 } 325 }
317 hostkeys_data = GNUNET_malloc (fs); 326 hostkeys_data = GNUNET_malloc (fs);
318 if (fs != GNUNET_DISK_file_read (fd, hostkeys_data, fs)) 327 sret = GNUNET_DISK_file_read (fd,
328 hostkeys_data,
329 fs);
330 if ( (sret < 0) ||
331 (fs != (size_t) sret) )
319 { 332 {
320 fprintf (stderr, 333 fprintf (stderr,
321 _("Could not read hostkey file: %s\n"), 334 _("Could not read hostkey file: %s\n"),
@@ -351,15 +364,21 @@ print_key (const char *filename)
351/** 364/**
352 * Main function that will be run by the scheduler. 365 * Main function that will be run by the scheduler.
353 * 366 *
354 * @param cls closure 367 * @param cls closure, NULL
355 * @param args remaining command-line arguments 368 * @param args remaining command-line arguments
356 * @param cfgfile name of the configuration file used (for saving, can be NULL!) 369 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
357 * @param cfg configuration 370 * @param cfg configuration
358 */ 371 */
359static void 372static void
360run (void *cls, char *const *args, const char *cfgfile, 373run (void *cls,
374 char *const *args,
375 const char *cfgfile,
361 const struct GNUNET_CONFIGURATION_Handle *cfg) 376 const struct GNUNET_CONFIGURATION_Handle *cfg)
362{ 377{
378 (void) cls;
379 (void) cfgfile;
380 (void) cfg;
381
363 if (print_examples_flag) 382 if (print_examples_flag)
364 { 383 {
365 print_examples (); 384 print_examples ();
diff --git a/src/util/gnunet-resolver.c b/src/util/gnunet-resolver.c
index 7ffafee32..4954e0398 100644
--- a/src/util/gnunet-resolver.c
+++ b/src/util/gnunet-resolver.c
@@ -46,9 +46,12 @@ static void
46print_hostname (void *cls, 46print_hostname (void *cls,
47 const char *hostname) 47 const char *hostname)
48{ 48{
49 (void) cls;
49 if (NULL == hostname) 50 if (NULL == hostname)
50 return; 51 return;
51 FPRINTF (stdout, "%s\n", hostname); 52 FPRINTF (stdout,
53 "%s\n",
54 hostname);
52} 55}
53 56
54 57
@@ -60,11 +63,17 @@ print_hostname (void *cls,
60 * @param addrlen length of the address 63 * @param addrlen length of the address
61 */ 64 */
62static void 65static void
63print_sockaddr (void *cls, const struct sockaddr *addr, socklen_t addrlen) 66print_sockaddr (void *cls,
67 const struct sockaddr *addr,
68 socklen_t addrlen)
64{ 69{
70 (void) cls;
65 if (NULL == addr) 71 if (NULL == addr)
66 return; 72 return;
67 FPRINTF (stdout, "%s\n", GNUNET_a2s (addr, addrlen)); 73 FPRINTF (stdout,
74 "%s\n",
75 GNUNET_a2s (addr,
76 addrlen));
68} 77}
69 78
70 79
@@ -77,7 +86,9 @@ print_sockaddr (void *cls, const struct sockaddr *addr, socklen_t addrlen)
77 * @param cfg configuration 86 * @param cfg configuration
78 */ 87 */
79static void 88static void
80run (void *cls, char *const *args, const char *cfgfile, 89run (void *cls,
90 char *const *args,
91 const char *cfgfile,
81 const struct GNUNET_CONFIGURATION_Handle *cfg) 92 const struct GNUNET_CONFIGURATION_Handle *cfg)
82{ 93{
83 const struct sockaddr *sa; 94 const struct sockaddr *sa;
@@ -85,11 +96,18 @@ run (void *cls, char *const *args, const char *cfgfile,
85 struct sockaddr_in v4; 96 struct sockaddr_in v4;
86 struct sockaddr_in6 v6; 97 struct sockaddr_in6 v6;
87 98
88 if (args[0] == NULL) 99 (void) cls;
100 (void) cfgfile;
101 (void) cfg;
102 if (NULL == args[0])
89 return; 103 return;
90 if (! reverse) 104 if (! reverse)
91 { 105 {
92 GNUNET_RESOLVER_ip_get (args[0], AF_UNSPEC, GET_TIMEOUT, &print_sockaddr, NULL); 106 GNUNET_RESOLVER_ip_get (args[0],
107 AF_UNSPEC,
108 GET_TIMEOUT,
109 &print_sockaddr,
110 NULL);
93 return; 111 return;
94 } 112 }
95 113
diff --git a/src/util/gnunet-service-resolver.c b/src/util/gnunet-service-resolver.c
index d26bdd212..ccb592349 100644
--- a/src/util/gnunet-service-resolver.c
+++ b/src/util/gnunet-service-resolver.c
@@ -582,7 +582,7 @@ get_ip_from_hostname (struct GNUNET_SERVICE_Client *client,
582/** 582/**
583 * Verify well-formedness of GET-message. 583 * Verify well-formedness of GET-message.
584 * 584 *
585 * @param cls closure 585 * @param cls closure, unused
586 * @param get the actual message 586 * @param get the actual message
587 * @return #GNUNET_OK if @a get is well-formed 587 * @return #GNUNET_OK if @a get is well-formed
588 */ 588 */
@@ -594,6 +594,7 @@ check_get (void *cls,
594 int direction; 594 int direction;
595 int af; 595 int af;
596 596
597 (void) cls;
597 size = ntohs (get->header.size) - sizeof (*get); 598 size = ntohs (get->header.size) - sizeof (*get);
598 direction = ntohl (get->direction); 599 direction = ntohl (get->direction);
599 if (GNUNET_NO == direction) 600 if (GNUNET_NO == direction)
@@ -688,7 +689,7 @@ handle_get (void *cls,
688/** 689/**
689 * Callback called when a client connects to the service. 690 * Callback called when a client connects to the service.
690 * 691 *
691 * @param cls closure for the service 692 * @param cls closure for the service, unused
692 * @param c the new client that connected to the service 693 * @param c the new client that connected to the service
693 * @param mq the message queue used to send messages to the client 694 * @param mq the message queue used to send messages to the client
694 * @return @a c 695 * @return @a c
@@ -698,6 +699,9 @@ connect_cb (void *cls,
698 struct GNUNET_SERVICE_Client *c, 699 struct GNUNET_SERVICE_Client *c,
699 struct GNUNET_MQ_Handle *mq) 700 struct GNUNET_MQ_Handle *mq)
700{ 701{
702 (void) cls;
703 (void) mq;
704
701 return c; 705 return c;
702} 706}
703 707
@@ -714,6 +718,8 @@ disconnect_cb (void *cls,
714 struct GNUNET_SERVICE_Client *c, 718 struct GNUNET_SERVICE_Client *c,
715 void *internal_cls) 719 void *internal_cls)
716{ 720{
721 (void) cls;
722
717 GNUNET_assert (c == internal_cls); 723 GNUNET_assert (c == internal_cls);
718} 724}
719 725
diff --git a/src/util/network.c b/src/util/network.c
index cf5ef3e00..d7059a057 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -1326,9 +1326,10 @@ GNUNET_NETWORK_fdset_handle_set (struct GNUNET_NETWORK_FDSet *fds,
1326#else 1326#else
1327 int fd; 1327 int fd;
1328 1328
1329 GNUNET_DISK_internal_file_handle_ (h, 1329 GNUNET_assert (GNUNET_OK ==
1330 &fd, 1330 GNUNET_DISK_internal_file_handle_ (h,
1331 sizeof (int)); 1331 &fd,
1332 sizeof (int)));
1332 FD_SET (fd, 1333 FD_SET (fd,
1333 &fds->sds); 1334 &fds->sds);
1334 fds->nsds = GNUNET_MAX (fd + 1, 1335 fds->nsds = GNUNET_MAX (fd + 1,
diff --git a/src/util/os_installation.c b/src/util/os_installation.c
index 1226c5966..2e35de681 100644
--- a/src/util/os_installation.c
+++ b/src/util/os_installation.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2006-2016 GNUnet e.V. 3 Copyright (C) 2006-2018 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -152,14 +152,21 @@ get_path_from_proc_exe ()
152 ssize_t size; 152 ssize_t size;
153 char *lep; 153 char *lep;
154 154
155 GNUNET_snprintf (fn, sizeof (fn), "/proc/%u/exe", getpid ()); 155 GNUNET_snprintf (fn,
156 size = readlink (fn, lnk, sizeof (lnk) - 1); 156 sizeof (fn),
157 "/proc/%u/exe",
158 getpid ());
159 size = readlink (fn,
160 lnk,
161 sizeof (lnk) - 1);
157 if (size <= 0) 162 if (size <= 0)
158 { 163 {
159 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "readlink", fn); 164 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR,
165 "readlink",
166 fn);
160 return NULL; 167 return NULL;
161 } 168 }
162 GNUNET_assert (size < sizeof (lnk)); 169 GNUNET_assert ( ((size_t) size) < sizeof (lnk));
163 lnk[size] = '\0'; 170 lnk[size] = '\0';
164 while ((lnk[size] != '/') && (size > 0)) 171 while ((lnk[size] != '/') && (size > 0))
165 size--; 172 size--;
@@ -167,12 +174,13 @@ get_path_from_proc_exe ()
167 "/%s/libexec/", 174 "/%s/libexec/",
168 current_pd->project_dirname); 175 current_pd->project_dirname);
169 /* test for being in lib/gnunet/libexec/ or lib/MULTIARCH/gnunet/libexec */ 176 /* test for being in lib/gnunet/libexec/ or lib/MULTIARCH/gnunet/libexec */
170 if ( (size > strlen (lep)) && 177 if ( (((size_t) size) > strlen (lep)) &&
171 (0 == strcmp (lep, 178 (0 == strcmp (lep,
172 &lnk[size - strlen (lep)])) ) 179 &lnk[size - strlen (lep)])) )
173 size -= strlen (lep) - 1; 180 size -= strlen (lep) - 1;
174 GNUNET_free (lep); 181 GNUNET_free (lep);
175 if ((size < 4) || (lnk[size - 4] != '/')) 182 if ( (size < 4) ||
183 (lnk[size - 4] != '/') )
176 { 184 {
177 /* not installed in "/bin/" -- binary path probably useless */ 185 /* not installed in "/bin/" -- binary path probably useless */
178 return NULL; 186 return NULL;
@@ -903,6 +911,7 @@ GNUNET_OS_check_helper_binary (const char *binary,
903 if (check_suid) 911 if (check_suid)
904 { 912 {
905#ifndef MINGW 913#ifndef MINGW
914 (void) params;
906 if ( (0 != (statbuf.st_mode & S_ISUID)) && 915 if ( (0 != (statbuf.st_mode & S_ISUID)) &&
907 (0 == statbuf.st_uid) ) 916 (0 == statbuf.st_uid) )
908 { 917 {
diff --git a/src/util/os_priority.c b/src/util/os_priority.c
index 2c4f7ca09..98998b520 100644
--- a/src/util/os_priority.c
+++ b/src/util/os_priority.c
@@ -154,6 +154,7 @@ GNUNET_OS_install_parent_control_handler (void *cls)
154 struct GNUNET_DISK_FileHandle *control_pipe; 154 struct GNUNET_DISK_FileHandle *control_pipe;
155 uint64_t pipe_fd; 155 uint64_t pipe_fd;
156 156
157 (void) cls;
157 if (NULL != pch) 158 if (NULL != pch)
158 { 159 {
159 /* already done, we've been called twice... */ 160 /* already done, we've been called twice... */
diff --git a/src/util/peer.c b/src/util/peer.c
index b637dc229..b1c65fbcf 100644
--- a/src/util/peer.c
+++ b/src/util/peer.c
@@ -201,7 +201,8 @@ GNUNET_PEER_change_rc (GNUNET_PEER_Id id, int delta)
201 return; 201 return;
202 GNUNET_assert (id < size); 202 GNUNET_assert (id < size);
203 GNUNET_assert (table[id]->rc > 0); 203 GNUNET_assert (table[id]->rc > 0);
204 GNUNET_assert ((delta >= 0) || (table[id]->rc >= -delta)); 204 GNUNET_assert ( (delta >= 0) ||
205 (table[id]->rc >= (unsigned int) (-delta)) );
205 table[id]->rc += delta; 206 table[id]->rc += delta;
206 if (0 == table[id]->rc) 207 if (0 == table[id]->rc)
207 { 208 {
diff --git a/src/util/program.c b/src/util/program.c
index 233792387..9e3037b8b 100644
--- a/src/util/program.c
+++ b/src/util/program.c
@@ -74,6 +74,7 @@ struct CommandContext
74static void 74static void
75shutdown_task (void *cls) 75shutdown_task (void *cls)
76{ 76{
77 (void) cls;
77 GNUNET_SPEEDUP_stop_ (); 78 GNUNET_SPEEDUP_stop_ ();
78} 79}
79 80
diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c
index 84f541ba0..bd46b4fbb 100644
--- a/src/util/resolver_api.c
+++ b/src/util/resolver_api.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2009-2016 GNUnet e.V. 3 Copyright (C) 2009-2018 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -214,7 +214,8 @@ check_config ()
214 for (unsigned int i = 0; 214 for (unsigned int i = 0;
215 NULL != loopback[i]; 215 NULL != loopback[i];
216 i++) 216 i++)
217 if (0 == strcasecmp (loopback[i], hostname)) 217 if (0 == strcasecmp (loopback[i],
218 hostname))
218 { 219 {
219 GNUNET_free (hostname); 220 GNUNET_free (hostname);
220 return GNUNET_OK; 221 return GNUNET_OK;
@@ -285,6 +286,7 @@ GNUNET_RESOLVER_disconnect ()
285static void 286static void
286shutdown_task (void *cls) 287shutdown_task (void *cls)
287{ 288{
289 (void) cls;
288 s_task = NULL; 290 s_task = NULL;
289 GNUNET_RESOLVER_disconnect (); 291 GNUNET_RESOLVER_disconnect ();
290 backoff = GNUNET_TIME_UNIT_MILLISECONDS; 292 backoff = GNUNET_TIME_UNIT_MILLISECONDS;
@@ -387,10 +389,12 @@ static void
387mq_error_handler (void *cls, 389mq_error_handler (void *cls,
388 enum GNUNET_MQ_Error error) 390 enum GNUNET_MQ_Error error)
389{ 391{
392 (void) cls;
390 GNUNET_MQ_destroy (mq); 393 GNUNET_MQ_destroy (mq);
391 mq = NULL; 394 mq = NULL;
392 LOG (GNUNET_ERROR_TYPE_DEBUG, 395 LOG (GNUNET_ERROR_TYPE_DEBUG,
393 "MQ error, reconnecting\n"); 396 "MQ error %d, reconnecting\n",
397 error);
394 reconnect (); 398 reconnect ();
395} 399}
396 400
@@ -449,6 +453,9 @@ static int
449check_response (void *cls, 453check_response (void *cls,
450 const struct GNUNET_MessageHeader *msg) 454 const struct GNUNET_MessageHeader *msg)
451{ 455{
456 (void) cls;
457 (void) msg;
458
452 /* implemented in #handle_response() for now */ 459 /* implemented in #handle_response() for now */
453 return GNUNET_OK; 460 return GNUNET_OK;
454} 461}
@@ -470,6 +477,7 @@ handle_response (void *cls,
470 uint16_t size; 477 uint16_t size;
471 char *nret; 478 char *nret;
472 479
480 (void) cls;
473 GNUNET_assert (NULL != rh); 481 GNUNET_assert (NULL != rh);
474 size = ntohs (msg->size); 482 size = ntohs (msg->size);
475 if (size == sizeof (struct GNUNET_MessageHeader)) 483 if (size == sizeof (struct GNUNET_MessageHeader))
@@ -743,6 +751,7 @@ reconnect_task (void *cls)
743 GNUNET_MQ_handler_end () 751 GNUNET_MQ_handler_end ()
744 }; 752 };
745 753
754 (void) cls;
746 r_task = NULL; 755 r_task = NULL;
747 if (NULL == req_head) 756 if (NULL == req_head)
748 return; /* no work pending */ 757 return; /* no work pending */
diff --git a/src/util/scheduler.c b/src/util/scheduler.c
index b96e4e6c4..fecbc0de5 100644
--- a/src/util/scheduler.c
+++ b/src/util/scheduler.c
@@ -513,14 +513,14 @@ static void
513dump_backtrace (struct GNUNET_SCHEDULER_Task *t) 513dump_backtrace (struct GNUNET_SCHEDULER_Task *t)
514{ 514{
515#if EXECINFO 515#if EXECINFO
516 unsigned int i; 516 for (unsigned int i = 0; i < t->num_backtrace_strings; i++)
517
518 for (i = 0; i < t->num_backtrace_strings; i++)
519 LOG (GNUNET_ERROR_TYPE_WARNING, 517 LOG (GNUNET_ERROR_TYPE_WARNING,
520 "Task %p trace %u: %s\n", 518 "Task %p trace %u: %s\n",
521 t, 519 t,
522 i, 520 i,
523 t->backtrace_strings[i]); 521 t->backtrace_strings[i]);
522#else
523 (void) t;
524#endif 524#endif
525} 525}
526 526
@@ -847,20 +847,19 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
847 * @param et the event type to be set in each FdInfo after calling 847 * @param et the event type to be set in each FdInfo after calling
848 * @a driver_func on it, or -1 if no updating not desired. 848 * @a driver_func on it, or -1 if no updating not desired.
849 */ 849 */
850void driver_add_multiple (struct GNUNET_SCHEDULER_Task *t, 850static void
851 enum GNUNET_SCHEDULER_EventType et) 851driver_add_multiple (struct GNUNET_SCHEDULER_Task *t)
852{ 852{
853 struct GNUNET_SCHEDULER_FdInfo *fdi; 853 struct GNUNET_SCHEDULER_FdInfo *fdi;
854 int success = GNUNET_YES; 854 int success = GNUNET_YES;
855 855
856 for (int i = 0; i != t->fds_len; ++i) 856 for (unsigned int i = 0; i != t->fds_len; ++i)
857 { 857 {
858 fdi = &t->fds[i]; 858 fdi = &t->fds[i];
859 success = scheduler_driver->add (scheduler_driver->cls, t, fdi) && success; 859 success = scheduler_driver->add (scheduler_driver->cls,
860 if (et != -1) 860 t,
861 { 861 fdi) && success;
862 fdi->et = et; 862 fdi->et = GNUNET_SCHEDULER_ET_NONE;
863 }
864 } 863 }
865 if (GNUNET_YES != success) 864 if (GNUNET_YES != success)
866 { 865 {
@@ -870,12 +869,13 @@ void driver_add_multiple (struct GNUNET_SCHEDULER_Task *t,
870} 869}
871 870
872 871
873void 872static void
874shutdown_cb (void *cls) 873shutdown_cb (void *cls)
875{ 874{
876 char c; 875 char c;
877 const struct GNUNET_DISK_FileHandle *pr; 876 const struct GNUNET_DISK_FileHandle *pr;
878 877
878 (void) cls;
879 pr = GNUNET_DISK_pipe_handle (shutdown_pipe_handle, 879 pr = GNUNET_DISK_pipe_handle (shutdown_pipe_handle,
880 GNUNET_DISK_PIPE_END_READ); 880 GNUNET_DISK_PIPE_END_READ);
881 GNUNET_assert (! GNUNET_DISK_handle_invalid (pr)); 881 GNUNET_assert (! GNUNET_DISK_handle_invalid (pr));
@@ -975,6 +975,8 @@ init_backtrace (struct GNUNET_SCHEDULER_Task *t)
975 backtrace_symbols (backtrace_array, 975 backtrace_symbols (backtrace_array,
976 t->num_backtrace_strings); 976 t->num_backtrace_strings);
977 dump_backtrace (t); 977 dump_backtrace (t);
978#else
979 (void) t;
978#endif 980#endif
979} 981}
980 982
@@ -1375,7 +1377,7 @@ add_without_sets (struct GNUNET_TIME_Relative delay,
1375 GNUNET_CONTAINER_DLL_insert (pending_head, 1377 GNUNET_CONTAINER_DLL_insert (pending_head,
1376 pending_tail, 1378 pending_tail,
1377 t); 1379 t);
1378 driver_add_multiple (t, GNUNET_SCHEDULER_ET_NONE); 1380 driver_add_multiple (t);
1379 max_priority_added = GNUNET_MAX (max_priority_added, 1381 max_priority_added = GNUNET_MAX (max_priority_added,
1380 t->priority); 1382 t->priority);
1381 init_backtrace (t); 1383 init_backtrace (t);
@@ -1664,14 +1666,15 @@ extract_handles (struct GNUNET_SCHEDULER_Task *t,
1664 // in fdset must be handled separately 1666 // in fdset must be handled separately
1665 const struct GNUNET_NETWORK_Handle **nhandles; 1667 const struct GNUNET_NETWORK_Handle **nhandles;
1666 const struct GNUNET_DISK_FileHandle **fhandles; 1668 const struct GNUNET_DISK_FileHandle **fhandles;
1667 unsigned int nhandles_len, fhandles_len; 1669 unsigned int nhandles_len;
1668 int sock; 1670 unsigned int fhandles_len;
1669 1671
1672 (void) t;
1670 nhandles = NULL; 1673 nhandles = NULL;
1671 fhandles = NULL; 1674 fhandles = NULL;
1672 nhandles_len = 0; 1675 nhandles_len = 0;
1673 fhandles_len = 0; 1676 fhandles_len = 0;
1674 for (sock = 0; sock != fdset->nsds; ++sock) 1677 for (int sock = 0; sock != fdset->nsds; ++sock)
1675 { 1678 {
1676 if (GNUNET_YES == GNUNET_NETWORK_fdset_test_native (fdset, sock)) 1679 if (GNUNET_YES == GNUNET_NETWORK_fdset_test_native (fdset, sock))
1677 { 1680 {
@@ -1816,7 +1819,7 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio,
1816 GNUNET_CONTAINER_DLL_insert (pending_head, 1819 GNUNET_CONTAINER_DLL_insert (pending_head,
1817 pending_tail, 1820 pending_tail,
1818 t); 1821 t);
1819 driver_add_multiple (t, GNUNET_SCHEDULER_ET_NONE); 1822 driver_add_multiple (t);
1820 max_priority_added = GNUNET_MAX (max_priority_added, 1823 max_priority_added = GNUNET_MAX (max_priority_added,
1821 t->priority); 1824 t->priority);
1822 LOG (GNUNET_ERROR_TYPE_DEBUG, 1825 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1969,7 +1972,7 @@ GNUNET_SCHEDULER_run_from_driver (struct GNUNET_SCHEDULER_Handle *sh)
1969 // FIXME: do we have to remove FdInfos from fds if they are not ready? 1972 // FIXME: do we have to remove FdInfos from fds if they are not ready?
1970 tc.fds_len = pos->fds_len; 1973 tc.fds_len = pos->fds_len;
1971 tc.fds = pos->fds; 1974 tc.fds = pos->fds;
1972 for (int i = 0; i != pos->fds_len; ++i) 1975 for (unsigned int i = 0; i != pos->fds_len; ++i)
1973 { 1976 {
1974 struct GNUNET_SCHEDULER_FdInfo *fdi = &pos->fds[i]; 1977 struct GNUNET_SCHEDULER_FdInfo *fdi = &pos->fds[i];
1975 if (0 != (GNUNET_SCHEDULER_ET_IN & fdi->et)) 1978 if (0 != (GNUNET_SCHEDULER_ET_IN & fdi->et))
diff --git a/src/util/service.c b/src/util/service.c
index b4eb33caa..1156093f4 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -1978,7 +1978,7 @@ do_send (void *cls)
1978 GNUNET_MQ_impl_send_in_flight (client->mq); 1978 GNUNET_MQ_impl_send_in_flight (client->mq);
1979 } 1979 }
1980 client->msg_pos += ret; 1980 client->msg_pos += ret;
1981 if (left > ret) 1981 if (left > (size_t) ret)
1982 { 1982 {
1983 GNUNET_assert (NULL == client->drop_task); 1983 GNUNET_assert (NULL == client->drop_task);
1984 client->send_task 1984 client->send_task
@@ -2007,6 +2007,7 @@ service_mq_send (struct GNUNET_MQ_Handle *mq,
2007{ 2007{
2008 struct GNUNET_SERVICE_Client *client = impl_state; 2008 struct GNUNET_SERVICE_Client *client = impl_state;
2009 2009
2010 (void) mq;
2010 if (NULL != client->drop_task) 2011 if (NULL != client->drop_task)
2011 return; /* we're going down right now, do not try to send */ 2012 return; /* we're going down right now, do not try to send */
2012 GNUNET_assert (NULL == client->send_task); 2013 GNUNET_assert (NULL == client->send_task);
@@ -2036,6 +2037,7 @@ service_mq_cancel (struct GNUNET_MQ_Handle *mq,
2036{ 2037{
2037 struct GNUNET_SERVICE_Client *client = impl_state; 2038 struct GNUNET_SERVICE_Client *client = impl_state;
2038 2039
2040 (void) mq;
2039 GNUNET_assert (0 == client->msg_pos); 2041 GNUNET_assert (0 == client->msg_pos);
2040 client->msg = NULL; 2042 client->msg = NULL;
2041 GNUNET_SCHEDULER_cancel (client->send_task); 2043 GNUNET_SCHEDULER_cancel (client->send_task);
diff --git a/src/util/speedup.c b/src/util/speedup.c
index c6a4cf678..f5e81f16b 100644
--- a/src/util/speedup.c
+++ b/src/util/speedup.c
@@ -42,6 +42,7 @@ do_speedup (void *cls)
42{ 42{
43 static long long current_offset; 43 static long long current_offset;
44 44
45 (void) cls;
45 speedup_task = NULL; 46 speedup_task = NULL;
46 current_offset += delta.rel_value_us; 47 current_offset += delta.rel_value_us;
47 GNUNET_TIME_set_offset (current_offset); 48 GNUNET_TIME_set_offset (current_offset);
diff --git a/src/util/strings.c b/src/util/strings.c
index f554a9e83..4cfcd63b3 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -1069,11 +1069,13 @@ GNUNET_STRINGS_string_to_data (const char *enc, size_t enclen,
1069 * (if they weren't NULL). 1069 * (if they weren't NULL).
1070 */ 1070 */
1071int 1071int
1072GNUNET_STRINGS_parse_uri (const char *path, char **scheme_part, 1072GNUNET_STRINGS_parse_uri (const char *path,
1073 const char **path_part) 1073 char **scheme_part,
1074 const char **path_part)
1074{ 1075{
1075 size_t len; 1076 size_t len;
1076 int i, end; 1077 size_t i;
1078 int end;
1077 int pp_state = 0; 1079 int pp_state = 0;
1078 const char *post_scheme_part = NULL; 1080 const char *post_scheme_part = NULL;
1079 len = strlen (path); 1081 len = strlen (path);
@@ -1082,7 +1084,7 @@ GNUNET_STRINGS_parse_uri (const char *path, char **scheme_part,
1082 switch (pp_state) 1084 switch (pp_state)
1083 { 1085 {
1084 case 0: 1086 case 0:
1085 if (path[i] == ':' && i > 0) 1087 if ( (path[i] == ':') && (i > 0) )
1086 { 1088 {
1087 pp_state += 1; 1089 pp_state += 1;
1088 continue; 1090 continue;
diff --git a/src/vpn/gnunet-helper-vpn.c b/src/vpn/gnunet-helper-vpn.c
index 4ed4e079e..26f77d2fc 100644
--- a/src/vpn/gnunet-helper-vpn.c
+++ b/src/vpn/gnunet-helper-vpn.c
@@ -649,6 +649,7 @@ main (int argc, char **argv)
649 { 649 {
650 fprintf (stderr, 650 fprintf (stderr,
651 "Fatal: prefix_len out of range\n"); 651 "Fatal: prefix_len out of range\n");
652 close (fd_tun);
652 return 1; 653 return 1;
653 } 654 }
654 655