aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/common_logging.c13
-rw-r--r--src/util/container_slist.c3
-rw-r--r--src/util/disk.c3
-rw-r--r--src/util/getopt.c15
-rw-r--r--src/util/network.c24
-rw-r--r--src/util/os_priority.c9
-rw-r--r--src/util/program.c6
-rw-r--r--src/util/pseudonym.c3
-rw-r--r--src/util/server.c2
9 files changed, 46 insertions, 32 deletions
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index 995f2e88a..2c0fd57a8 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -530,6 +530,8 @@ parse_all_definitions ()
530 gnunet_force_log_parsed = GNUNET_YES; 530 gnunet_force_log_parsed = GNUNET_YES;
531} 531}
532#endif 532#endif
533
534
533/** 535/**
534 * Setup logging. 536 * Setup logging.
535 * 537 *
@@ -569,17 +571,16 @@ GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile)
569 if (NULL == fn) 571 if (NULL == fn)
570 return GNUNET_SYSERR; 572 return GNUNET_SYSERR;
571 dirwarn = (GNUNET_OK != GNUNET_DISK_directory_create_for_file (fn)); 573 dirwarn = (GNUNET_OK != GNUNET_DISK_directory_create_for_file (fn));
572 altlog_fd = OPEN (fn, O_APPEND |
573#if WINDOWS 574#if WINDOWS
575 altlog_fd = OPEN (fn, O_APPEND |
574 O_BINARY | 576 O_BINARY |
575#endif
576 O_WRONLY | O_CREAT, 577 O_WRONLY | O_CREAT,
577#if WINDOWS 578 _S_IREAD | _S_IWRITE);
578 _S_IREAD | _S_IWRITE
579#else 579#else
580 S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH 580 altlog_fd = OPEN (fn, O_APPEND |
581 O_WRONLY | O_CREAT,
582 S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
581#endif 583#endif
582 );
583 if (altlog_fd != -1) 584 if (altlog_fd != -1)
584 { 585 {
585 int dup_return; 586 int dup_return;
diff --git a/src/util/container_slist.c b/src/util/container_slist.c
index 950c4245e..6b5832583 100644
--- a/src/util/container_slist.c
+++ b/src/util/container_slist.c
@@ -268,6 +268,7 @@ GNUNET_CONTAINER_slist_contains (const struct GNUNET_CONTAINER_SList *l,
268 return GNUNET_NO; 268 return GNUNET_NO;
269} 269}
270 270
271typedef int (*Comparator)(const void *, size_t, const void *, size_t);
271 272
272/** 273/**
273 * Check if a list contains a certain element 274 * Check if a list contains a certain element
@@ -283,7 +284,7 @@ GNUNET_CONTAINER_slist_contains (const struct GNUNET_CONTAINER_SList *l,
283void * 284void *
284GNUNET_CONTAINER_slist_contains2 (const struct GNUNET_CONTAINER_SList *l, 285GNUNET_CONTAINER_slist_contains2 (const struct GNUNET_CONTAINER_SList *l,
285 const void *buf, size_t len, 286 const void *buf, size_t len,
286 int (*compare)(const void *, const size_t, const void *, const size_t)) 287 Comparator compare)
287{ 288{
288 struct GNUNET_CONTAINER_SList_Elem *e; 289 struct GNUNET_CONTAINER_SList_Elem *e;
289 290
diff --git a/src/util/disk.c b/src/util/disk.c
index 847dad457..cba0d4467 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -270,7 +270,8 @@ GNUNET_DISK_file_seek (const struct GNUNET_DISK_FileHandle * h, OFF_T offset,
270 } 270 }
271 271
272#ifdef MINGW 272#ifdef MINGW
273 LARGE_INTEGER li, new_pos; 273 LARGE_INTEGER li;
274 LARGE_INTEGER new_pos;
274 BOOL b; 275 BOOL b;
275 276
276 static DWORD t[] = {[GNUNET_DISK_SEEK_SET] = FILE_BEGIN, 277 static DWORD t[] = {[GNUNET_DISK_SEEK_SET] = FILE_BEGIN,
diff --git a/src/util/getopt.c b/src/util/getopt.c
index 169949821..572e534c5 100644
--- a/src/util/getopt.c
+++ b/src/util/getopt.c
@@ -202,9 +202,8 @@ char *
202getenv (); 202getenv ();
203 203
204static char * 204static char *
205my_index (str, chr) 205my_index (const char *str,
206 const char *str; 206 int chr)
207 int chr;
208{ 207{
209 while (*str) 208 while (*str)
210 { 209 {
@@ -294,8 +293,7 @@ exchange (char **);
294#endif 293#endif
295 294
296static void 295static void
297exchange (argv) 296exchange (char **argv)
298 char **argv;
299{ 297{
300 int bottom = first_nonopt; 298 int bottom = first_nonopt;
301 int middle = last_nonopt; 299 int middle = last_nonopt;
@@ -381,10 +379,9 @@ static const char *
381_getopt_initialize (int, char *const *, const char *); 379_getopt_initialize (int, char *const *, const char *);
382#endif 380#endif
383static const char * 381static const char *
384_getopt_initialize (argc, argv, optstring) 382_getopt_initialize (int argc,
385 int argc; 383 char *const *argv,
386 char *const *argv; 384 const char *optstring)
387 const char *optstring;
388{ 385{
389 /* Start processing options with ARGV-element 1 (since ARGV-element 0 386 /* Start processing options with ARGV-element 1 (since ARGV-element 0
390 * is the program name); the sequence of previously skipped 387 * is the program name); the sequence of previously skipped
diff --git a/src/util/network.c b/src/util/network.c
index 54abcaba1..9323389ee 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -508,15 +508,16 @@ GNUNET_NETWORK_socket_recvfrom_amount (const struct GNUNET_NETWORK_Handle *
508 508
509 error = ioctl (desc->fd, FIONREAD, &pending); 509 error = ioctl (desc->fd, FIONREAD, &pending);
510 if (error == 0) 510 if (error == 0)
511 return (ssize_t) pending;
512 return GNUNET_NO;
511#else 513#else
512 u_long pending; 514 u_long pending;
513 515
514 error = ioctlsocket (desc->fd, FIONREAD, &pending); 516 error = ioctlsocket (desc->fd, FIONREAD, &pending);
515 if (error != SOCKET_ERROR) 517 if (error != SOCKET_ERROR)
518 return (ssize_t) pending;
519 return GNUNET_NO;
516#endif 520#endif
517 return pending;
518 else
519 return GNUNET_NO;
520} 521}
521 522
522 523
@@ -1079,7 +1080,6 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds,
1079 const struct GNUNET_TIME_Relative timeout) 1080 const struct GNUNET_TIME_Relative timeout)
1080{ 1081{
1081 int nfds = 0; 1082 int nfds = 0;
1082
1083#ifdef MINGW 1083#ifdef MINGW
1084 int handles = 0; 1084 int handles = 0;
1085 int ex_handles = 0; 1085 int ex_handles = 0;
@@ -1090,7 +1090,9 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds,
1090 int retcode = 0; 1090 int retcode = 0;
1091 DWORD ms_total = 0; 1091 DWORD ms_total = 0;
1092 1092
1093 int nsock = 0, nhandles = 0, nSockEvents = 0; 1093 int nsock = 0;
1094 int nhandles = 0;
1095 int nSockEvents = 0;
1094 1096
1095 static HANDLE hEventRead = 0; 1097 static HANDLE hEventRead = 0;
1096 static HANDLE hEventWrite = 0; 1098 static HANDLE hEventWrite = 0;
@@ -1106,12 +1108,18 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds,
1106 DWORD newretcode = 0; 1108 DWORD newretcode = 0;
1107 int returnedpos = 0; 1109 int returnedpos = 0;
1108 1110
1109 struct GNUNET_CONTAINER_SList *handles_read, *handles_write, *handles_except; 1111 struct GNUNET_CONTAINER_SList *handles_read;
1112 struct GNUNET_CONTAINER_SList *handles_write;
1113 struct GNUNET_CONTAINER_SList *handles_except;
1110 1114
1111 fd_set aread, awrite, aexcept; 1115 fd_set aread;
1116 fd_set awrite;
1117 fd_set except;
1112 1118
1113#if DEBUG_NETWORK 1119#if DEBUG_NETWORK
1114 fd_set bread, bwrite, bexcept; 1120 fd_set bread;
1121 fd_set bwrite;
1122 fd_set bexcept;
1115#endif 1123#endif
1116 1124
1117 /* TODO: Make this growable */ 1125 /* TODO: Make this growable */
diff --git a/src/util/os_priority.c b/src/util/os_priority.c
index f374ca56d..9def6ca54 100644
--- a/src/util/os_priority.c
+++ b/src/util/os_priority.c
@@ -649,10 +649,15 @@ GNUNET_OS_set_process_priority (struct GNUNET_OS_Process *proc,
649static char * 649static char *
650CreateCustomEnvTable (char **vars) 650CreateCustomEnvTable (char **vars)
651{ 651{
652 char *win32_env_table, *ptr, **var_ptr, *result, *result_ptr; 652 char *win32_env_table;
653 char *ptr;
654 char **var_ptr;
655 char *result;
656 char *result_ptr;
653 size_t tablesize = 0; 657 size_t tablesize = 0;
654 size_t items_count = 0; 658 size_t items_count = 0;
655 size_t n_found = 0, n_var; 659 size_t n_found = 0;
660 size_t n_var;
656 char *index = NULL; 661 char *index = NULL;
657 size_t c; 662 size_t c;
658 size_t var_len; 663 size_t var_len;
diff --git a/src/util/program.c b/src/util/program.c
index bfa58dc65..b6d0c78c6 100644
--- a/src/util/program.c
+++ b/src/util/program.c
@@ -95,10 +95,10 @@ program_main (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
95 * @param a2 second command line option 95 * @param a2 second command line option
96 */ 96 */
97static int 97static int
98cmd_sorter (__const void *a1, __const void *a2) 98cmd_sorter (const void *a1, const void *a2)
99{ 99{
100 __const struct GNUNET_GETOPT_CommandLineOption *c1 = a1; 100 const struct GNUNET_GETOPT_CommandLineOption *c1 = a1;
101 __const struct GNUNET_GETOPT_CommandLineOption *c2 = a2; 101 const struct GNUNET_GETOPT_CommandLineOption *c2 = a2;
102 102
103 if (toupper ((unsigned char) c1->shortName) > 103 if (toupper ((unsigned char) c1->shortName) >
104 toupper ((unsigned char) c2->shortName)) 104 toupper ((unsigned char) c2->shortName))
diff --git a/src/util/pseudonym.c b/src/util/pseudonym.c
index d2efdc98f..016573845 100644
--- a/src/util/pseudonym.c
+++ b/src/util/pseudonym.c
@@ -539,7 +539,8 @@ list_pseudonym_helper (void *cls, const char *fullname)
539 int32_t rating; 539 int32_t rating;
540 struct GNUNET_CONTAINER_MetaData *meta; 540 struct GNUNET_CONTAINER_MetaData *meta;
541 const char *fn; 541 const char *fn;
542 char *str, *name_unique; 542 char *str;
543 char *name_unique;
543 544
544 if (strlen (fullname) < sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)) 545 if (strlen (fullname) < sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded))
545 return GNUNET_OK; 546 return GNUNET_OK;
diff --git a/src/util/server.c b/src/util/server.c
index 6226dea6d..f707d1bf3 100644
--- a/src/util/server.c
+++ b/src/util/server.c
@@ -391,7 +391,7 @@ process_listen_socket (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
391static struct GNUNET_NETWORK_Handle * 391static struct GNUNET_NETWORK_Handle *
392open_listen_socket (const struct sockaddr *serverAddr, socklen_t socklen) 392open_listen_socket (const struct sockaddr *serverAddr, socklen_t socklen)
393{ 393{
394 const static int on = 1; 394 static int on = 1;
395 struct GNUNET_NETWORK_Handle *sock; 395 struct GNUNET_NETWORK_Handle *sock;
396 uint16_t port; 396 uint16_t port;
397 int eno; 397 int eno;