summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-07-06 11:14:11 +0000
committerChristian Grothoff <christian@grothoff.org>2016-07-06 11:14:11 +0000
commitf5beb3eaf163fc0bf2a4f86bd413d3ee6939cfea (patch)
treeb59a38ad9e2296b3d2c8cc3302f21cf6d3ecc458 /src
parent6db64c5eae089e1d81cafbb051f65412790d16bc (diff)
downloadgnunet-f5beb3eaf163fc0bf2a4f86bd413d3ee6939cfea.tar.gz
gnunet-f5beb3eaf163fc0bf2a4f86bd413d3ee6939cfea.zip
-fix misc issues
Diffstat (limited to 'src')
-rw-r--r--src/arm/arm_api.c4
-rw-r--r--src/ats-tests/ats-testing-log.c2
-rw-r--r--src/ats-tests/gnunet-solver-eval.c32
-rw-r--r--src/exit/gnunet-daemon-exit.c8
-rw-r--r--src/gns/gnunet-gns-proxy.c4
-rw-r--r--src/gns/gnunet-service-gns_interceptor.c2
-rw-r--r--src/gns/gnunet-service-gns_resolver.c1
-rw-r--r--src/gnsrecord/gnsrecord_misc.c2
-rw-r--r--src/include/gnunet_pq_lib.h3
-rw-r--r--src/namestore/plugin_namestore_sqlite.c2
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_stop.c25
-rw-r--r--src/nse/perf_kdf.c2
-rw-r--r--src/peerinfo/gnunet-service-peerinfo.c17
-rw-r--r--src/pq/pq.c9
-rw-r--r--src/regex/gnunet-regex-profiler.c32
-rw-r--r--src/regex/regex_internal.c6
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c2
-rw-r--r--src/util/bandwidth.c2
-rw-r--r--src/util/disk.c10
-rw-r--r--src/util/network.c6
-rw-r--r--src/util/test_server.c1
21 files changed, 108 insertions, 64 deletions
diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c
index ed36c61cd..19b192378 100644
--- a/src/arm/arm_api.c
+++ b/src/arm/arm_api.c
@@ -322,7 +322,7 @@ check_arm_list_result (void *cls,
322{ 322{
323 const char *pos = (const char *) &lres[1]; 323 const char *pos = (const char *) &lres[1];
324 uint16_t rcount = ntohs (lres->count); 324 uint16_t rcount = ntohs (lres->count);
325 uint16_t msize = ntohs (lres->arm_msg.header.size); 325 uint16_t msize = ntohs (lres->arm_msg.header.size) - sizeof (*lres);
326 uint16_t size_check; 326 uint16_t size_check;
327 327
328 size_check = 0; 328 size_check = 0;
@@ -355,7 +355,7 @@ handle_arm_list_result (void *cls,
355 uint16_t rcount = ntohs (lres->count); 355 uint16_t rcount = ntohs (lres->count);
356 const char *list[rcount]; 356 const char *list[rcount];
357 const char *pos = (const char *) &lres[1]; 357 const char *pos = (const char *) &lres[1];
358 uint16_t msize = ntohs (lres->arm_msg.header.size); 358 uint16_t msize = ntohs (lres->arm_msg.header.size) - sizeof (*lres);
359 struct GNUNET_ARM_Operation *op; 359 struct GNUNET_ARM_Operation *op;
360 uint16_t size_check; 360 uint16_t size_check;
361 uint64_t id; 361 uint64_t id;
diff --git a/src/ats-tests/ats-testing-log.c b/src/ats-tests/ats-testing-log.c
index 2442a8249..61aca6b18 100644
--- a/src/ats-tests/ats-testing-log.c
+++ b/src/ats-tests/ats-testing-log.c
@@ -686,7 +686,7 @@ GNUNET_ATS_TEST_logging_now (struct LoggingHandle *l)
686 } 686 }
687 else 687 else
688 { 688 {
689 mlt->total_throughput_send = 0; 689 mlt->total_throughput_recv = 0;
690 //mlt->total_throughput_recv = prev_log_mlt->total_throughput_recv; /* no msgs received */ 690 //mlt->total_throughput_recv = prev_log_mlt->total_throughput_recv; /* no msgs received */
691 } 691 }
692 } 692 }
diff --git a/src/ats-tests/gnunet-solver-eval.c b/src/ats-tests/gnunet-solver-eval.c
index 0d2460b7f..0e49a3a32 100644
--- a/src/ats-tests/gnunet-solver-eval.c
+++ b/src/ats-tests/gnunet-solver-eval.c
@@ -65,6 +65,7 @@ create_experiment ()
65 return e; 65 return e;
66} 66}
67 67
68
68static void 69static void
69free_experiment (struct Experiment *e) 70free_experiment (struct Experiment *e)
70{ 71{
@@ -92,9 +93,11 @@ free_experiment (struct Experiment *e)
92 GNUNET_free (e); 93 GNUNET_free (e);
93} 94}
94 95
96
95static int 97static int
96load_episode (struct Experiment *e, struct Episode *cur, 98load_episode (struct Experiment *e,
97 struct GNUNET_CONFIGURATION_Handle *cfg) 99 struct Episode *cur,
100 struct GNUNET_CONFIGURATION_Handle *cfg)
98{ 101{
99 struct GNUNET_ATS_TEST_Operation *o; 102 struct GNUNET_ATS_TEST_Operation *o;
100 char *sec_name; 103 char *sec_name;
@@ -186,8 +189,12 @@ load_episode (struct Experiment *e, struct Episode *cur,
186 } 189 }
187 if (o->dest_id > (e->num_slaves - 1)) 190 if (o->dest_id > (e->num_slaves - 1))
188 { 191 {
189 fprintf (stderr, "Invalid destination %llu in operation %u `%s' in episode %u\n", 192 fprintf (stderr,
190 o->dest_id, op_counter, op, cur->id); 193 "Invalid destination %llu in operation %u `%s' in episode %u\n",
194 o->dest_id,
195 op_counter,
196 op,
197 cur->id);
191 GNUNET_free (op); 198 GNUNET_free (op);
192 GNUNET_free (op_name); 199 GNUNET_free (op_name);
193 GNUNET_free (sec_name); 200 GNUNET_free (sec_name);
@@ -197,9 +204,13 @@ load_episode (struct Experiment *e, struct Episode *cur,
197 GNUNET_free (op_name); 204 GNUNET_free (op_name);
198 205
199 GNUNET_asprintf(&op_name, "op-%u-type", op_counter); 206 GNUNET_asprintf(&op_name, "op-%u-type", op_counter);
200 if ( (GNUNET_SYSERR != GNUNET_CONFIGURATION_get_value_string(cfg, 207 if ( (GNUNET_SYSERR !=
201 sec_name, op_name, &type)) && 208 GNUNET_CONFIGURATION_get_value_string(cfg,
202 ((STOP_SEND != o->type) || (STOP_PREFERENCE != o->type))) 209 sec_name,
210 op_name,
211 &type)) &&
212 (STOP_SEND != o->type) &&
213 (STOP_PREFERENCE != o->type) )
203 { 214 {
204 /* Load arguments for set_rate, start_send, set_preference */ 215 /* Load arguments for set_rate, start_send, set_preference */
205 if (0 == strcmp (type, "constant")) 216 if (0 == strcmp (type, "constant"))
@@ -249,8 +260,11 @@ load_episode (struct Experiment *e, struct Episode *cur,
249 260
250 /* Get max rate */ 261 /* Get max rate */
251 GNUNET_asprintf(&op_name, "op-%u-max-rate", op_counter); 262 GNUNET_asprintf(&op_name, "op-%u-max-rate", op_counter);
252 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, 263 if (GNUNET_SYSERR ==
253 sec_name, op_name, &o->max_rate)) 264 GNUNET_CONFIGURATION_get_value_number (cfg,
265 sec_name,
266 op_name,
267 &o->max_rate))
254 { 268 {
255 if ((GNUNET_ATS_TEST_TG_LINEAR == o->gen_type) || 269 if ((GNUNET_ATS_TEST_TG_LINEAR == o->gen_type) ||
256 (GNUNET_ATS_TEST_TG_RANDOM == o->gen_type) || 270 (GNUNET_ATS_TEST_TG_RANDOM == o->gen_type) ||
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c
index 854d12006..7c67313e6 100644
--- a/src/exit/gnunet-daemon-exit.c
+++ b/src/exit/gnunet-daemon-exit.c
@@ -3671,13 +3671,17 @@ run (void *cls,
3671 3671
3672 if (GNUNET_YES == ipv6_enabled) 3672 if (GNUNET_YES == ipv6_enabled)
3673 { 3673 {
3674 ipv6addr = NULL;
3674 if ( (GNUNET_SYSERR == 3675 if ( (GNUNET_SYSERR ==
3675 GNUNET_CONFIGURATION_get_value_string (cfg, "exit", "IPV6ADDR", 3676 GNUNET_CONFIGURATION_get_value_string (cfg,
3677 "exit",
3678 "IPV6ADDR",
3676 &ipv6addr) || 3679 &ipv6addr) ||
3677 (1 != inet_pton (AF_INET6, ipv6addr, &exit_ipv6addr))) ) 3680 (1 != inet_pton (AF_INET6, ipv6addr, &exit_ipv6addr))) )
3678 { 3681 {
3679 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "EXIT", "IPV6ADDR"); 3682 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "EXIT", "IPV6ADDR");
3680 GNUNET_SCHEDULER_shutdown (); 3683 GNUNET_SCHEDULER_shutdown ();
3684 GNUNET_free_non_null (ipv6addr);
3681 return; 3685 return;
3682 } 3686 }
3683 exit_argv[3] = ipv6addr; 3687 exit_argv[3] = ipv6addr;
@@ -3710,6 +3714,7 @@ run (void *cls,
3710 } 3714 }
3711 if (GNUNET_YES == ipv4_enabled) 3715 if (GNUNET_YES == ipv4_enabled)
3712 { 3716 {
3717 ipv4addr = NULL;
3713 if ( (GNUNET_SYSERR == 3718 if ( (GNUNET_SYSERR ==
3714 GNUNET_CONFIGURATION_get_value_string (cfg, "exit", "IPV4ADDR", 3719 GNUNET_CONFIGURATION_get_value_string (cfg, "exit", "IPV4ADDR",
3715 &ipv4addr) || 3720 &ipv4addr) ||
@@ -3717,6 +3722,7 @@ run (void *cls,
3717 { 3722 {
3718 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "EXIT", "IPV4ADDR"); 3723 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "EXIT", "IPV4ADDR");
3719 GNUNET_SCHEDULER_shutdown (); 3724 GNUNET_SCHEDULER_shutdown ();
3725 GNUNET_free_non_null (ipv4addr);
3720 return; 3726 return;
3721 } 3727 }
3722 exit_argv[5] = ipv4addr; 3728 exit_argv[5] = ipv4addr;
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c
index 7ab8843bb..83935ff76 100644
--- a/src/gns/gnunet-gns-proxy.c
+++ b/src/gns/gnunet-gns-proxy.c
@@ -409,7 +409,7 @@ enum SocksPhase
409 SOCKS5_SOCKET_WITH_MHD, 409 SOCKS5_SOCKET_WITH_MHD,
410 410
411 /** 411 /**
412 * We've finished receiving upload data from MHD. 412 * We've started receiving upload data from MHD.
413 */ 413 */
414 SOCKS5_SOCKET_UPLOAD_STARTED, 414 SOCKS5_SOCKET_UPLOAD_STARTED,
415 415
@@ -1230,7 +1230,7 @@ curl_upload_cb (void *buf, size_t size, size_t nmemb, void *cls)
1230 "Completed CURL UPLOAD\n"); 1230 "Completed CURL UPLOAD\n");
1231 return 0; /* upload finished, can now download */ 1231 return 0; /* upload finished, can now download */
1232 } 1232 }
1233 if ( (SOCKS5_SOCKET_UPLOAD_STARTED != s5r->state) || 1233 if ( (SOCKS5_SOCKET_UPLOAD_STARTED != s5r->state) &&
1234 (SOCKS5_SOCKET_UPLOAD_DONE != s5r->state) ) 1234 (SOCKS5_SOCKET_UPLOAD_DONE != s5r->state) )
1235 { 1235 {
1236 GNUNET_break (0); 1236 GNUNET_break (0);
diff --git a/src/gns/gnunet-service-gns_interceptor.c b/src/gns/gnunet-service-gns_interceptor.c
index 4d57230a1..7a3cfc0dd 100644
--- a/src/gns/gnunet-service-gns_interceptor.c
+++ b/src/gns/gnunet-service-gns_interceptor.c
@@ -261,6 +261,8 @@ reply_to_dns (void *cls, uint32_t rd_count,
261 { 261 {
262 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 262 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
263 _("Error converting GNS response to DNS response!\n")); 263 _("Error converting GNS response to DNS response!\n"));
264 if (GNUNET_NO == ret)
265 GNUNET_free (buf);
264 } 266 }
265 else 267 else
266 { 268 {
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index 2dec9a2af..ce6428a44 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -1323,6 +1323,7 @@ handle_gns2dns_result (void *cls,
1323 /* expand authority chain */ 1323 /* expand authority chain */
1324 ac = GNUNET_new (struct AuthorityChain); 1324 ac = GNUNET_new (struct AuthorityChain);
1325 ac->rh = rh; 1325 ac->rh = rh;
1326 GNUNET_assert (strlen (rh->g2dc->ns) <= GNUNET_DNSPARSER_MAX_NAME_LENGTH);
1326 strcpy (ac->authority_info.dns_authority.name, 1327 strcpy (ac->authority_info.dns_authority.name,
1327 rh->g2dc->ns); 1328 rh->g2dc->ns);
1328 memcpy (&ac->authority_info.dns_authority.dns_ip, 1329 memcpy (&ac->authority_info.dns_authority.dns_ip,
diff --git a/src/gnsrecord/gnsrecord_misc.c b/src/gnsrecord/gnsrecord_misc.c
index 27d1e7b21..4c3bf6fa8 100644
--- a/src/gnsrecord/gnsrecord_misc.c
+++ b/src/gnsrecord/gnsrecord_misc.c
@@ -185,7 +185,7 @@ GNUNET_GNSRECORD_record_get_expiration_time (unsigned int rd_count,
185 /* We have a shadow record */ 185 /* We have a shadow record */
186 if (0 != (rd[c2].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION)) 186 if (0 != (rd[c2].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION))
187 { 187 {
188 rt_shadow.rel_value_us = rd[2].expiration_time; 188 rt_shadow.rel_value_us = rd[c2].expiration_time;
189 at_shadow = GNUNET_TIME_relative_to_absolute (rt_shadow); 189 at_shadow = GNUNET_TIME_relative_to_absolute (rt_shadow);
190 } 190 }
191 else 191 else
diff --git a/src/include/gnunet_pq_lib.h b/src/include/gnunet_pq_lib.h
index 4e4139b43..33a3e5425 100644
--- a/src/include/gnunet_pq_lib.h
+++ b/src/include/gnunet_pq_lib.h
@@ -442,15 +442,12 @@ GNUNET_PQ_exec_prepared (PGconn *db_conn,
442 442
443/** 443/**
444 * Extract results from a query result according to the given specification. 444 * Extract results from a query result according to the given specification.
445 * If colums are NULL, the destination is not modified, and #GNUNET_NO
446 * is returned.
447 * 445 *
448 * @param result result to process 446 * @param result result to process
449 * @param[in,out] rs result specification to extract for 447 * @param[in,out] rs result specification to extract for
450 * @param row row from the result to extract 448 * @param row row from the result to extract
451 * @return 449 * @return
452 * #GNUNET_YES if all results could be extracted 450 * #GNUNET_YES if all results could be extracted
453 * #GNUNET_NO if at least one result was NULL
454 * #GNUNET_SYSERR if a result was invalid (non-existing field) 451 * #GNUNET_SYSERR if a result was invalid (non-existing field)
455 */ 452 */
456int 453int
diff --git a/src/namestore/plugin_namestore_sqlite.c b/src/namestore/plugin_namestore_sqlite.c
index d6a2a2862..3710a4820 100644
--- a/src/namestore/plugin_namestore_sqlite.c
+++ b/src/namestore/plugin_namestore_sqlite.c
@@ -315,7 +315,7 @@ database_shutdown (struct Plugin *plugin)
315 sqlite3_finalize (plugin->iterate_all_zones); 315 sqlite3_finalize (plugin->iterate_all_zones);
316 if (NULL != plugin->zone_to_name) 316 if (NULL != plugin->zone_to_name)
317 sqlite3_finalize (plugin->zone_to_name); 317 sqlite3_finalize (plugin->zone_to_name);
318 if (NULL != plugin->zone_to_name) 318 if (NULL != plugin->lookup_label)
319 sqlite3_finalize (plugin->lookup_label); 319 sqlite3_finalize (plugin->lookup_label);
320 result = sqlite3_close (plugin->dbh); 320 result = sqlite3_close (plugin->dbh);
321 if (result == SQLITE_BUSY) 321 if (result == SQLITE_BUSY)
diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c
index 52645b5eb..36f527da0 100644
--- a/src/namestore/test_namestore_api_zone_iteration_stop.c
+++ b/src/namestore/test_namestore_api_zone_iteration_stop.c
@@ -365,27 +365,26 @@ empty_zone_proc (void *cls,
365 char *hostkey_file; 365 char *hostkey_file;
366 366
367 GNUNET_assert (nsh == cls); 367 GNUNET_assert (nsh == cls);
368 if (NULL != zone) 368 if (NULL != zone)
369 { 369 {
370 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 370 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
371 _("Expected empty zone but received zone private key\n")); 371 _("Expected empty zone but received zone private key\n"));
372 GNUNET_break (0); 372 GNUNET_break (0);
373 if (endbadly_task != NULL) 373 if (endbadly_task != NULL)
374 GNUNET_SCHEDULER_cancel (endbadly_task); 374 GNUNET_SCHEDULER_cancel (endbadly_task);
375 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); 375 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
376 return; 376 return;
377 } 377 }
378 if ((NULL != label) || (NULL != rd) || (0 != rd)) 378 if ((NULL != label) || (NULL != rd) || (0 != rd_count))
379 { 379 {
380 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 380 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
381 _("Expected no zone content but received data\n")); 381 _("Expected no zone content but received data\n"));
382 GNUNET_break (0); 382 GNUNET_break (0);
383 if (endbadly_task != NULL) 383 if (endbadly_task != NULL)
384 GNUNET_SCHEDULER_cancel (endbadly_task); 384 GNUNET_SCHEDULER_cancel (endbadly_task);
385 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); 385 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
386 return; 386 return;
387 } 387 }
388
389 388
390 zi = NULL; 389 zi = NULL;
391 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, 390 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR,
diff --git a/src/nse/perf_kdf.c b/src/nse/perf_kdf.c
index b62b5eba6..4981eae5d 100644
--- a/src/nse/perf_kdf.c
+++ b/src/nse/perf_kdf.c
@@ -76,7 +76,7 @@ main (int argc, char *argv[])
76 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), 76 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start),
77 GNUNET_YES)); 77 GNUNET_YES));
78 GAUGER ("NSE", "Proof-of-work hashing", 78 GAUGER ("NSE", "Proof-of-work hashing",
79 1024 / (1 + 79 1024LL / (1LL +
80 GNUNET_TIME_absolute_get_duration 80 GNUNET_TIME_absolute_get_duration
81 (start).rel_value_us / 1000LL), "hashes/ms"); 81 (start).rel_value_us / 1000LL), "hashes/ms");
82 return 0; 82 return 0;
diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c
index 66082e8f7..8be6cf5ab 100644
--- a/src/peerinfo/gnunet-service-peerinfo.c
+++ b/src/peerinfo/gnunet-service-peerinfo.c
@@ -338,12 +338,12 @@ read_host_file (const char *fn,
338 struct ReadHostFileContext *r) 338 struct ReadHostFileContext *r)
339{ 339{
340 char buffer[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1] GNUNET_ALIGN; 340 char buffer[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1] GNUNET_ALIGN;
341 unsigned int size_total; 341 ssize_t size_total;
342 struct GNUNET_TIME_Absolute now; 342 struct GNUNET_TIME_Absolute now;
343 unsigned int left; 343 unsigned int left;
344 const struct GNUNET_HELLO_Message *hello; 344 const struct GNUNET_HELLO_Message *hello;
345 struct GNUNET_HELLO_Message *hello_clean; 345 struct GNUNET_HELLO_Message *hello_clean;
346 unsigned read_pos; 346 size_t read_pos;
347 int size_hello; 347 int size_hello;
348 348
349 r->friend_only_hello = NULL; 349 r->friend_only_hello = NULL;
@@ -1005,6 +1005,7 @@ discard_hosts_helper (void *cls,
1005 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING | 1005 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING |
1006 GNUNET_ERROR_TYPE_BULK, 1006 GNUNET_ERROR_TYPE_BULK,
1007 "unlink", fn); 1007 "unlink", fn);
1008 GNUNET_free (writebuffer);
1008 return GNUNET_OK; 1009 return GNUNET_OK;
1009 } 1010 }
1010 new_hello = GNUNET_HELLO_iterate_addresses (hello, 1011 new_hello = GNUNET_HELLO_iterate_addresses (hello,
@@ -1028,11 +1029,13 @@ discard_hosts_helper (void *cls,
1028 1029
1029 if (0 < write_pos) 1030 if (0 < write_pos)
1030 { 1031 {
1031 GNUNET_DISK_fn_write (fn, writebuffer,write_pos, 1032 GNUNET_DISK_fn_write (fn,
1032 GNUNET_DISK_PERM_USER_READ | 1033 writebuffer,
1033 GNUNET_DISK_PERM_USER_WRITE | 1034 write_pos,
1034 GNUNET_DISK_PERM_GROUP_READ | 1035 GNUNET_DISK_PERM_USER_READ |
1035 GNUNET_DISK_PERM_OTHER_READ); 1036 GNUNET_DISK_PERM_USER_WRITE |
1037 GNUNET_DISK_PERM_GROUP_READ |
1038 GNUNET_DISK_PERM_OTHER_READ);
1036 } 1039 }
1037 else if (0 != UNLINK (fn)) 1040 else if (0 != UNLINK (fn))
1038 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING | 1041 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING |
diff --git a/src/pq/pq.c b/src/pq/pq.c
index 43186c41e..46463a190 100644
--- a/src/pq/pq.c
+++ b/src/pq/pq.c
@@ -119,15 +119,13 @@ GNUNET_PQ_cleanup_result (struct GNUNET_PQ_ResultSpec *rs)
119 119
120/** 120/**
121 * Extract results from a query result according to the given 121 * Extract results from a query result according to the given
122 * specification. If colums are NULL, the destination is not 122 * specification.
123 * modified, and #GNUNET_NO is returned.
124 * 123 *
125 * @param result result to process 124 * @param result result to process
126 * @param[in,out] rs result specification to extract for 125 * @param[in,out] rs result specification to extract for
127 * @param row row from the result to extract 126 * @param row row from the result to extract
128 * @return 127 * @return
129 * #GNUNET_YES if all results could be extracted 128 * #GNUNET_YES if all results could be extracted
130 * #GNUNET_NO if at least one result was NULL
131 * #GNUNET_SYSERR if a result was invalid (non-existing field) 129 * #GNUNET_SYSERR if a result was invalid (non-existing field)
132 */ 130 */
133int 131int
@@ -136,7 +134,6 @@ GNUNET_PQ_extract_result (PGresult *result,
136 int row) 134 int row)
137{ 135{
138 unsigned int i; 136 unsigned int i;
139 int had_null = GNUNET_NO;
140 int ret; 137 int ret;
141 138
142 for (i=0; NULL != rs[i].conv; i++) 139 for (i=0; NULL != rs[i].conv; i++)
@@ -150,7 +147,7 @@ GNUNET_PQ_extract_result (PGresult *result,
150 spec->fname, 147 spec->fname,
151 &spec->dst_size, 148 &spec->dst_size,
152 spec->dst); 149 spec->dst);
153 if (GNUNET_SYSERR == ret) 150 if (GNUNET_OK != ret)
154 { 151 {
155 GNUNET_PQ_cleanup_result (rs); 152 GNUNET_PQ_cleanup_result (rs);
156 return GNUNET_SYSERR; 153 return GNUNET_SYSERR;
@@ -158,8 +155,6 @@ GNUNET_PQ_extract_result (PGresult *result,
158 if (NULL != spec->result_size) 155 if (NULL != spec->result_size)
159 *spec->result_size = spec->dst_size; 156 *spec->result_size = spec->dst_size;
160 } 157 }
161 if (GNUNET_YES == had_null)
162 return GNUNET_NO;
163 return GNUNET_OK; 158 return GNUNET_OK;
164} 159}
165 160
diff --git a/src/regex/gnunet-regex-profiler.c b/src/regex/gnunet-regex-profiler.c
index 2114e2cb1..c5ecf3b4d 100644
--- a/src/regex/gnunet-regex-profiler.c
+++ b/src/regex/gnunet-regex-profiler.c
@@ -1231,41 +1231,55 @@ load_search_strings (const char *filename,
1231 "Could not find search strings file %s\n", filename); 1231 "Could not find search strings file %s\n", filename);
1232 return GNUNET_SYSERR; 1232 return GNUNET_SYSERR;
1233 } 1233 }
1234 if (GNUNET_OK != GNUNET_DISK_file_size (filename, &filesize, GNUNET_YES, GNUNET_YES)) 1234 if (GNUNET_OK !=
1235 GNUNET_DISK_file_size (filename,
1236 &filesize,
1237 GNUNET_YES,
1238 GNUNET_YES))
1235 filesize = 0; 1239 filesize = 0;
1236 if (0 == filesize) 1240 if (0 == filesize)
1237 { 1241 {
1238 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Search strings file %s is empty.\n", filename); 1242 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1243 "Search strings file %s is empty.\n",
1244 filename);
1239 return GNUNET_SYSERR; 1245 return GNUNET_SYSERR;
1240 } 1246 }
1241 data = GNUNET_malloc (filesize); 1247 data = GNUNET_malloc (filesize + 1);
1242 if (filesize != GNUNET_DISK_fn_read (filename, data, filesize)) 1248 if (filesize != GNUNET_DISK_fn_read (filename,
1249 data,
1250 filesize))
1243 { 1251 {
1244 GNUNET_free (data); 1252 GNUNET_free (data);
1245 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Could not read search strings file %s.\n", 1253 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1254 "Could not read search strings file %s.\n",
1246 filename); 1255 filename);
1247 return GNUNET_SYSERR; 1256 return GNUNET_SYSERR;
1248 } 1257 }
1249 buf = data; 1258 buf = data;
1250 offset = 0; 1259 offset = 0;
1251 str_cnt = 0; 1260 str_cnt = 0;
1252 while (offset < (filesize - 1) && str_cnt < limit) 1261 while ( (offset < (filesize - 1)) && (str_cnt < limit) )
1253 { 1262 {
1254 offset++; 1263 offset++;
1255 if (((data[offset] == '\n')) && (buf != &data[offset])) 1264 if ( ((data[offset] == '\n')) &&
1265 (buf != &data[offset]) )
1256 { 1266 {
1257 data[offset] = '\0'; 1267 data[offset] = '\0';
1258 str_cnt++; 1268 str_cnt++;
1259 buf = &data[offset + 1]; 1269 buf = &data[offset + 1];
1260 } 1270 }
1261 else if ((data[offset] == '\n') || (data[offset] == '\0')) 1271 else if ( (data[offset] == '\n') ||
1272 (data[offset] == '\0') )
1262 buf = &data[offset + 1]; 1273 buf = &data[offset + 1];
1263 } 1274 }
1264 *strings = GNUNET_malloc (sizeof (char *) * str_cnt); 1275 *strings = GNUNET_malloc (sizeof (char *) * str_cnt);
1265 offset = 0; 1276 offset = 0;
1266 for (i = 0; i < str_cnt; i++) 1277 for (i = 0; i < str_cnt; i++)
1267 { 1278 {
1268 GNUNET_asprintf (&(*strings)[i], "%s%s", regex_prefix, &data[offset]); 1279 GNUNET_asprintf (&(*strings)[i],
1280 "%s%s",
1281 regex_prefix,
1282 &data[offset]);
1269 offset += strlen (&data[offset]) + 1; 1283 offset += strlen (&data[offset]) + 1;
1270 } 1284 }
1271 GNUNET_free (data); 1285 GNUNET_free (data);
diff --git a/src/regex/regex_internal.c b/src/regex/regex_internal.c
index 616b7f141..cb78545b9 100644
--- a/src/regex/regex_internal.c
+++ b/src/regex/regex_internal.c
@@ -2037,9 +2037,9 @@ dfa_merge_nondistinguishable_states (struct REGEX_INTERNAL_Context *ctx,
2037 /* same edge, but targets definitively different, so we're different 2037 /* same edge, but targets definitively different, so we're different
2038 as well */ 2038 as well */
2039 if (t1->to_state->marked > t2->to_state->marked) 2039 if (t1->to_state->marked > t2->to_state->marked)
2040 idx1 = t1->to_state->marked * state_cnt + t2->to_state->marked; 2040 idx1 = (unsigned long long) t1->to_state->marked * state_cnt + t2->to_state->marked;
2041 else 2041 else
2042 idx1 = t2->to_state->marked * state_cnt + t1->to_state->marked; 2042 idx1 = (unsigned long long) t2->to_state->marked * state_cnt + t1->to_state->marked;
2043 if (0 != (table[idx1 / 32] & (1 << (idx1 % 32)))) 2043 if (0 != (table[idx1 / 32] & (1 << (idx1 % 32))))
2044 { 2044 {
2045 table[idx / 32] |= (1 << (idx % 32)); 2045 table[idx / 32] |= (1 << (idx % 32));
@@ -2066,7 +2066,7 @@ dfa_merge_nondistinguishable_states (struct REGEX_INTERNAL_Context *ctx,
2066 for (s2 = a->states_head; NULL != s2 && s1 != s2; s2 = s2_next) 2066 for (s2 = a->states_head; NULL != s2 && s1 != s2; s2 = s2_next)
2067 { 2067 {
2068 s2_next = s2->next; 2068 s2_next = s2->next;
2069 idx = s1->marked * state_cnt + s2->marked; 2069 idx = (unsigned long long) s1->marked * state_cnt + s2->marked;
2070 if (0 == (table[idx / 32] & (1 << (idx % 32)))) 2070 if (0 == (table[idx / 32] & (1 << (idx % 32))))
2071 automaton_merge_states (ctx, a, s1, s2); 2071 automaton_merge_states (ctx, a, s1, s2);
2072 } 2072 }
diff --git a/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c b/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
index 9d0bf57b1..a8dce9115 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
@@ -357,7 +357,7 @@ destroy_service_session (struct BobServiceSession *s)
357 gcry_mpi_point_release (s->prod_g_i_b_i); 357 gcry_mpi_point_release (s->prod_g_i_b_i);
358 s->prod_g_i_b_i = NULL; 358 s->prod_g_i_b_i = NULL;
359 } 359 }
360 if (NULL != s->prod_g_i_b_i) 360 if (NULL != s->prod_h_i_b_i)
361 { 361 {
362 gcry_mpi_point_release (s->prod_h_i_b_i); 362 gcry_mpi_point_release (s->prod_h_i_b_i);
363 s->prod_h_i_b_i = NULL; 363 s->prod_h_i_b_i = NULL;
diff --git a/src/util/bandwidth.c b/src/util/bandwidth.c
index 364c46977..bc5c02d60 100644
--- a/src/util/bandwidth.c
+++ b/src/util/bandwidth.c
@@ -177,7 +177,7 @@ update_excess (struct GNUNET_BANDWIDTH_Tracker *av)
177 500000LL) / 1000000LL; 177 500000LL) / 1000000LL;
178 current_consumption = av->consumption_since_last_update__ - delta_avail; 178 current_consumption = av->consumption_since_last_update__ - delta_avail;
179 /* negative current_consumption means that we have savings */ 179 /* negative current_consumption means that we have savings */
180 max_carry = av->available_bytes_per_s__ * av->max_carry_s__; 180 max_carry = (uint64_t) av->available_bytes_per_s__ * av->max_carry_s__;
181 if (max_carry < GNUNET_SERVER_MAX_MESSAGE_SIZE) 181 if (max_carry < GNUNET_SERVER_MAX_MESSAGE_SIZE)
182 max_carry = GNUNET_SERVER_MAX_MESSAGE_SIZE; 182 max_carry = GNUNET_SERVER_MAX_MESSAGE_SIZE;
183 left_bytes = max_carry + current_consumption; 183 left_bytes = max_carry + current_consumption;
diff --git a/src/util/disk.c b/src/util/disk.c
index 4624df7c1..d9ebde84f 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -527,14 +527,18 @@ char *
527GNUNET_DISK_mkdtemp (const char *t) 527GNUNET_DISK_mkdtemp (const char *t)
528{ 528{
529 char *fn; 529 char *fn;
530 mode_t omask;
530 531
532 omask = umask (S_IWGRP | S_IWOTH | SIRGRP | S_IROTH);
531 fn = mktemp_name (t); 533 fn = mktemp_name (t);
532 if (fn != mkdtemp (fn)) 534 if (fn != mkdtemp (fn))
533 { 535 {
534 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "mkstemp", fn); 536 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "mkdtemp", fn);
535 GNUNET_free (fn); 537 GNUNET_free (fn);
538 umask (omask);
536 return NULL; 539 return NULL;
537 } 540 }
541 umask (omask);
538 return fn; 542 return fn;
539} 543}
540 544
@@ -587,14 +591,18 @@ GNUNET_DISK_mktemp (const char *t)
587{ 591{
588 int fd; 592 int fd;
589 char *fn; 593 char *fn;
594 mode_t omask;
590 595
596 omask = umask (S_IWGRP | S_IWOTH | SIRGRP | S_IROTH);
591 fn = mktemp_name (t); 597 fn = mktemp_name (t);
592 if (-1 == (fd = mkstemp (fn))) 598 if (-1 == (fd = mkstemp (fn)))
593 { 599 {
594 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "mkstemp", fn); 600 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "mkstemp", fn);
595 GNUNET_free (fn); 601 GNUNET_free (fn);
602 umask (omask);
596 return NULL; 603 return NULL;
597 } 604 }
605 umask (omask);
598 if (0 != CLOSE (fd)) 606 if (0 != CLOSE (fd))
599 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "close", fn); 607 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "close", fn);
600 return fn; 608 return fn;
diff --git a/src/util/network.c b/src/util/network.c
index e42dfc4dc..ba213b412 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -166,6 +166,12 @@ GNUNET_NETWORK_unix_precheck (const struct sockaddr_un *un)
166 int ret; 166 int ret;
167 167
168 s = socket (AF_UNIX, SOCK_STREAM, 0); 168 s = socket (AF_UNIX, SOCK_STREAM, 0);
169 if (-1 == s)
170 {
171 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
172 "Failed to open AF_UNIX socket");
173 return;
174 }
169 ret = connect (s, 175 ret = connect (s,
170 (struct sockaddr *) un, 176 (struct sockaddr *) un,
171 sizeof (struct sockaddr_un)); 177 sizeof (struct sockaddr_un));
diff --git a/src/util/test_server.c b/src/util/test_server.c
index f82ecb2b1..384a1cef0 100644
--- a/src/util/test_server.c
+++ b/src/util/test_server.c
@@ -239,7 +239,6 @@ task (void *cls)
239 GNUNET_MQ_handler_end () 239 GNUNET_MQ_handler_end ()
240 }; 240 };
241 241
242
243 sap[0] = (struct sockaddr *) &sa; 242 sap[0] = (struct sockaddr *) &sa;
244 slens[0] = sizeof (sa); 243 slens[0] = sizeof (sa);
245 sap[1] = NULL; 244 sap[1] = NULL;