diff options
author | Nick Mathewson <nickm@torproject.org> | 2009-01-05 08:12:33 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-01-05 08:12:33 +0000 |
commit | 21e7fcbbfeafaae59fbd18d5704663ceae20f438 (patch) | |
tree | 86943d648da5b55a3f64a23d05ab724e10805b38 | |
parent | 1a19dbef294aac21941356efa2f9cf581cf8507b (diff) | |
download | tor-21e7fcbbfeafaae59fbd18d5704663ceae20f438.tar.gz tor-21e7fcbbfeafaae59fbd18d5704663ceae20f438.zip |
Backport 17891 and 17892 to fix openbsd build warnings. Also backport snarky comments.
svn:r17908
-rw-r--r-- | doc/TODO.020 | 4 | ||||
-rw-r--r-- | src/common/torgzip.c | 11 | ||||
-rw-r--r-- | src/common/util.c | 5 | ||||
-rw-r--r-- | src/or/directory.c | 2 |
4 files changed, 19 insertions, 3 deletions
diff --git a/doc/TODO.020 b/doc/TODO.020 index f524e1bd34..cee44befb8 100644 --- a/doc/TODO.020 +++ b/doc/TODO.020 @@ -3,8 +3,8 @@ description of the patch.) Backport for 0.2.0: - - r17891: Fix a fun OpenBSD warning. - - r17892: Fix another fun OpenBSD warning. + o r17891: Fix a fun OpenBSD warning. + o r17892: Fix another fun OpenBSD warning. Backport for 0.2.0 once better tested: Xo r16621: Make some DNS code more robust (partial; see also libevent diff --git a/src/common/torgzip.c b/src/common/torgzip.c index d1289443e2..103f2025df 100644 --- a/src/common/torgzip.c +++ b/src/common/torgzip.c @@ -143,7 +143,16 @@ tor_gzip_compress(char **out, size_t *out_len, } done: *out_len = stream->total_out; - if (stream->total_out > out_size + 4097) { +#ifdef OPENBSD + /* "Hey Rocky! Watch me change an unsigned field to a signed field in a + * third-party API!" + * "Oh, that trick will just make people do unsafe casts to the unsigned + * type in their cross-platform code!" + * "Don't be foolish. I'm _sure_ they'll have the good sense to make sure + * the newly unsigned field isn't negative." */ + tor_assert(stream->total_out >= 0); +#endif + if (((size_t)stream->total_out) > out_size + 4097) { /* If we're wasting more than 4k, don't. */ *out = tor_realloc(*out, stream->total_out + 1); } diff --git a/src/common/util.c b/src/common/util.c index b57d8a9f8d..af6c3d02a9 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -73,8 +73,13 @@ const char util_c_id[] = "$Id$"; #include <malloc/malloc.h> #endif #ifdef HAVE_MALLOC_H +#ifndef OPENBSD +/* OpenBSD has a malloc.h, but for our purposes, it only exists in order to + * scold us for being so stupid as to autodetect its presence. To be fair, + * they've done this since 1996, when autoconf was only 5 years old. */ #include <malloc.h> #endif +#endif /* ===== * Memory management diff --git a/src/or/directory.c b/src/or/directory.c index 9f1f130c5e..d0671fccf1 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -8,8 +8,10 @@ const char directory_c_id[] = #include "or.h" #if defined(EXPORTMALLINFO) && defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO) +#ifndef OPENBSD #include <malloc.h> #endif +#endif /** * \file directory.c |