diff options
author | zhenhaonong <zhenhaonong@tencent.com> | 2022-09-16 15:55:56 +0800 |
---|---|---|
committer | Azat Khuzhin <a3at.mail@gmail.com> | 2022-09-26 21:43:21 +0300 |
commit | f8bb9d84845be12b3ffb709bf9a26df4f40f898f (patch) | |
tree | 3fbe8a0f71a503bc43a45cfebf2d6edf0c574513 /test/regress_buffer.c | |
parent | 211c6653ae78e6cf79bfdb30cbbcdd0376345751 (diff) | |
download | libevent-f8bb9d84845be12b3ffb709bf9a26df4f40f898f.tar.gz |
Fix socketpair failure when temporary directory has non-latin character
Diffstat (limited to 'test/regress_buffer.c')
-rw-r--r-- | test/regress_buffer.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/regress_buffer.c b/test/regress_buffer.c index acd03ee3..5683810e 100644 --- a/test/regress_buffer.c +++ b/test/regress_buffer.c @@ -1199,6 +1199,10 @@ test_evbuffer_add_file(void *ptr) } fd = regress_make_tmpfile(data, datalen, &tmpfilename); + /* On Windows, if TMP environment variable is corrupted, we may not be + * able create temporary file, just skip it */ + if (fd < 0) + tt_skip(); if (map_from_offset) { starting_offset = datalen/4 + 1; @@ -1332,7 +1336,10 @@ test_evbuffer_file_segment_add_cleanup_cb(void* ptr) char const* arg = "token"; fd = regress_make_tmpfile("file_segment_test_file", 22, &tmpfilename); - tt_int_op(fd, >=, 0); + /* On Windows, if TMP environment variable is corrupted, we may not be + * able create temporary file, just skip it */ + if (fd < 0) + tt_skip(); evb = evbuffer_new(); tt_assert(evb); @@ -2587,6 +2594,11 @@ test_evbuffer_freeze(void *ptr) FREEZE_EQ(r, 0, -1); len = strlen(tmpfilecontent); fd = regress_make_tmpfile(tmpfilecontent, len, &tmpfilename); + /* On Windows, if TMP environment variable is corrupted, we may not be + * able create temporary file, just skip it */ + if (fd < 0) + tt_skip(); + r = evbuffer_add_file(buf, fd, 0, len); FREEZE_EQ(r, 0, -1); |