Merge pull request #3958 from bluca/fix_tests

Problems: formatting error in ip.cpp and test_bind_fuzzer doesn't build on OSX
This commit is contained in:
Luca Boccassi 2020-06-16 21:05:04 +01:00 committed by GitHub
commit b4aa912467
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -102,9 +102,8 @@ zmq::fd_t zmq::open_socket (int domain_, int type_, int protocol_)
#if defined ZMQ_HAVE_WINDOWS && defined WSA_FLAG_NO_HANDLE_INHERIT
// if supported, create socket with WSA_FLAG_NO_HANDLE_INHERIT, such that
// the race condition in making it non-inheritable later is avoided
const fd_t s =
WSASocket (domain_, type_, protocol_, NULL, 0,
WSA_FLAG_OVERLAPPED | WSA_FLAG_NO_HANDLE_INHERIT);
const fd_t s = WSASocket (domain_, type_, protocol_, NULL, 0,
WSA_FLAG_OVERLAPPED | WSA_FLAG_NO_HANDLE_INHERIT);
#else
const fd_t s = socket (domain_, type_, protocol_);
#endif

View File

@ -36,13 +36,18 @@
#include "testutil.hpp"
#include "testutil_unity.hpp"
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
// Test that zmq_bind can handle malformed strings
extern "C" int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size)
{
// This test might create socket files, so move to /tmp to avoid clobbering
// the working directory with random filenames
char *pwd = get_current_dir_name ();
char *pwd = (char *) malloc (PATH_MAX + 1);
TEST_ASSERT_NOT_NULL (pwd);
TEST_ASSERT_NOT_NULL (getcwd (pwd, PATH_MAX + 1));
TEST_ASSERT_SUCCESS_ERRNO (chdir ("/tmp"));
setup_test_context ();