On Aug 8, 2013, at 9:19, Adam Mercer <[email protected]> wrote:

> On Thu, Aug 8, 2013 at 10:22 AM, Jeremy Huddleston Sequoia
> <[email protected]> wrote:
> 
>> I added strndup to Libc in Lion, so it's not available in Snow Leopard.
>> 
>> The fix will be to add a static version of strndup when 
>> __MAC_OS_X_VERSION_MIN_REQUIRED < 1070:
>> http://opensource.apple.com/source/Libc/Libc-825.26/string/FreeBSD/strndup.c
> 
> So adding something like the following to the file that is failing is
> the appropriate fix?

Yep. Exactly.


> /*
> * Mac OS X 10.6 and lower do not contain strndup, define this
> * statically if needed
> */
> 
> #if __MAC_OS_X_VERSION_MIN_REQUIRED < 1070
> static char *strndup(const char *str, size_t n)
> {
>  size_t len;
>  char *copy;
> 
>  for (len = 0; len < n && str[len]; len++)
>    continue;
> 
>  if ((copy = malloc(len + 1)) == NULL)
>    return (NULL);
>  memcpy(copy, str, len);
>  copy[len] = '\0';
>  return (copy);
> }
> #endif
> 
> Cheers
> 
> Adam

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
macports-dev mailing list
[email protected]
https://lists.macosforge.org/mailman/listinfo/macports-dev

Reply via email to