From: Christian Grothoff Date: Fri, 11 Jun 2010 22:33:24 +0000 (+0000) Subject: minor fixes X-Git-Tag: initial-import-from-subversion-38251~21409 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=464d2cbfa3c56bd11c78667fc6e2f0a960f02f92;p=oweals%2Fgnunet.git minor fixes --- diff --git a/src/hostlist/hostlist-server.c b/src/hostlist/hostlist-server.c index 055c90bab..8d4d38d09 100644 --- a/src/hostlist/hostlist-server.c +++ b/src/hostlist/hostlist-server.c @@ -597,11 +597,19 @@ GNUNET_HOSTLIST_server_start (const struct GNUNET_CONFIGURATION_Handle *c, _("Could not access PEERINFO service. Exiting.\n")); return GNUNET_SYSERR; } - if (-1 == GNUNET_CONFIGURATION_get_value_number (cfg, - "HOSTLIST", - "HTTPPORT", - &port)) + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, + "HOSTLIST", + "HTTPPORT", + &port)) return GNUNET_SYSERR; + if ( (port == 0) || + (port > UINT16_MAX) ) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _("Invalid port number %llu. Exiting.\n"), + port); + return GNUNET_SYSERR; + } if ( GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg, "HOSTLIST", diff --git a/src/include/platform.h b/src/include/platform.h index fb9c992ec..7a974b48d 100644 --- a/src/include/platform.h +++ b/src/include/platform.h @@ -214,6 +214,10 @@ long long atoll (const char *nptr); #include "langinfo.h" #endif +#ifndef SIZE_MAX +#define SIZE_MAX ((size_t)(-1)) +#endif + #ifndef O_LARGEFILE #define O_LARGEFILE 0 #endif diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c index e8ac5ef4a..7c1f53d4b 100644 --- a/src/peerinfo/gnunet-service-peerinfo.c +++ b/src/peerinfo/gnunet-service-peerinfo.c @@ -329,8 +329,8 @@ change_host_trust (const struct GNUNET_PeerIdentity *hostId, int value) { if (host->trust + value < host->trust) { - value = ((uint32_t) - 1) - host->trust; - host->trust = (uint32_t) - 1; /* maximized */ + value = UINT32_MAX - host->trust; + host->trust = UINT32_MAX; } else host->trust += value; diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index 4f369812d..f4057e6d1 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c @@ -1488,7 +1488,7 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg, char *tran } } - GNUNET_free_non_null(temp_transports); + GNUNET_free (temp_transports); fclose(temp_file_handle); if (GNUNET_OK != diff --git a/src/util/strings.c b/src/util/strings.c index c868d1a97..1f7f45d51 100644 --- a/src/util/strings.c +++ b/src/util/strings.c @@ -204,7 +204,7 @@ GNUNET_STRINGS_to_utf8 (const char *input, size_t len, const char *charset) #else (char **) &input, #endif - &len, &itmp, &finSize) == (size_t) - 1) + &len, &itmp, &finSize) == SIZE_MAX) { GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "iconv"); iconv_close (cd);