summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-10-02 19:19:11 -0400
committerNick Mathewson <nickm@torproject.org>2019-10-02 19:19:11 -0400
commitbca30bcb90a7c01eea453b1fdf2b6ba368500e03 (patch)
tree6eb964e67d17cdc44830a7bf3838b2b8741b53be
parentca1f18c159fe2c46b32daf86334689afe2db4f94 (diff)
parent2420c8c9366e498dfaf3b4b6389ece9dc27ca537 (diff)
downloadtor-bca30bcb90a7c01eea453b1fdf2b6ba368500e03.tar.gz
tor-bca30bcb90a7c01eea453b1fdf2b6ba368500e03.zip
Merge remote-tracking branch 'tor-github/pr/1374'
-rw-r--r--changes/bug318973
-rw-r--r--src/test/test_util.c5
2 files changed, 6 insertions, 2 deletions
diff --git a/changes/bug31897 b/changes/bug31897
new file mode 100644
index 0000000000..81c63e704e
--- /dev/null
+++ b/changes/bug31897
@@ -0,0 +1,3 @@
+ o Minor bugfixes (tests, SunOS):
+ - Avoid a map_anon_nofork test failure due to a signed/unsigned integer
+ comparison. Fixes bug 31897; bugfix on 0.4.1.1-alpha.
diff --git a/src/test/test_util.c b/src/test/test_util.c
index 705ae862a8..5024b23400 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -6189,6 +6189,7 @@ test_util_map_anon_nofork(void *arg)
* crash, or send zero. */
char *ptr = NULL;
+ const char TEST_VALUE = 0xd0;
size_t sz = 16384;
int pipefd[2] = {-1, -1};
unsigned inherit=0;
@@ -6196,7 +6197,7 @@ test_util_map_anon_nofork(void *arg)
tor_munmap_anonymous(ptr, sz);
ptr = tor_mmap_anonymous(sz, ANONMAP_NOINHERIT, &inherit);
tt_ptr_op(ptr, OP_NE, 0);
- memset(ptr, 0xd0, sz);
+ memset(ptr, TEST_VALUE, sz);
tt_int_op(0, OP_EQ, pipe(pipefd));
pid_t child = fork();
@@ -6227,7 +6228,7 @@ test_util_map_anon_nofork(void *arg)
// noinherit isn't implemented.
tt_int_op(inherit, OP_EQ, INHERIT_RES_KEEP);
tt_int_op((int)r, OP_EQ, 1); // child should send us a byte.
- tt_int_op(buf[0], OP_EQ, 0xd0); // that byte should what we set it to.
+ tt_int_op(buf[0], OP_EQ, TEST_VALUE); // that byte should be TEST_VALUE.
}
int ws;