aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2010-06-11 22:33:24 +0000
committergrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2010-06-11 22:33:24 +0000
commitd6fc0cd34f9b7b521190f0c37d0da646371a4f9d (patch)
tree0d5ffb0a36890fc58bf1b53b4ef872c8f5f68279
parentcbcb799bf4a9f4c05ce80c7fff21ddc366f44e25 (diff)
minor fixes
git-svn-id: https://gnunet.org/svn/gnunet@11680 140774ce-b5e7-0310-ab8b-a85725594a96
-rw-r--r--src/hostlist/hostlist-server.c16
-rw-r--r--src/include/platform.h4
-rw-r--r--src/peerinfo/gnunet-service-peerinfo.c4
-rw-r--r--src/testing/testing_group.c2
-rw-r--r--src/util/strings.c2
5 files changed, 20 insertions, 8 deletions
diff --git a/src/hostlist/hostlist-server.c b/src/hostlist/hostlist-server.c
index 055c90bab4..8d4d38d091 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 fb9c992ec8..7a974b48d7 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 e8ac5ef4ae..7c1f53d4bd 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 4f369812de..f4057e6d13 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 c868d1a976..1f7f45d519 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);