aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/util/disk.c27
-rw-r--r--src/util/getopt_helpers.c79
-rw-r--r--src/util/scheduler.c14
3 files changed, 78 insertions, 42 deletions
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/scheduler.c b/src/util/scheduler.c
index b96e4e6c4..992f8fdff 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