Ticket #39122: zmq.patch

File zmq.patch, 1.5 KB (added by eborisch (Eric A. Borisch), 11 years ago)
  • Portfile

     
    3333
    3434universal_variant   yes
    3535
     36# Work-around (provide) missing strndup on Snow Leopard
     37if {[vercmp ${os.version} 10.9.0] < 0} {
     38    patchfiles          patch-tests-test_disconnect_inproc.cpp.diff
     39}
     40
    3641# macports libtool allows linking against libc++, the libtool in the distribution does not
    3742depends_build       port:libtool
    3843build.args          LIBTOOL=${prefix}/bin/glibtool
  • files/patch-tests-test_disconnect_inproc.cpp.diff

     
     1--- tests/test_disconnect_inproc.cpp.orig       2013-05-20 09:33:26.000000000 -0500
     2+++ tests/test_disconnect_inproc.cpp    2013-05-20 09:33:34.000000000 -0500
     3@@ -9,6 +9,21 @@
     4 zmq_msg_init_size (&msg, size + 1) && printf("zmq_msg_init_size: %s\n",zmq_strerror(errno)); \
     5 memcpy(zmq_msg_data(&msg), data, size + 1);
     6 
     7+char *strndup(const char *s, size_t n);
     8+
     9+char *strndup(const char *s, size_t n)
     10+{
     11+    size_t m = 0;
     12+    const char * p = s - 1;
     13+    if (n)
     14+        while (*++p && ++m < n) ;
     15+    char * const x = (char *) malloc(m + 1);
     16+    if (x == NULL) return NULL;
     17+    memcpy(x, s, m);
     18+    x[m] = 0;
     19+    return x;
     20+}
     21+
     22 int publicationsReceived = 0;
     23 bool isSubscribed = false;
     24