0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-14 09:47:56 +08:00

Problem: test_bind_fuzzer does not build on OSX

Solution: use POSIX API instead of GNU extension
This commit is contained in:
Luca Boccassi 2020-06-14 15:20:08 +01:00
parent 1d2af8d388
commit 3856027da9

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 ();