[128108] trunk/dports/security/gpg-agent

ionic at macports.org ionic at macports.org
Thu Nov 13 07:27:13 PST 2014


Revision: 128108
          https://trac.macports.org/changeset/128108
Author:   ionic at macports.org
Date:     2014-11-13 07:27:13 -0800 (Thu, 13 Nov 2014)
Log Message:
-----------
gpg-agent: add strndup compat function for OS X 10.6 and below.

Modified Paths:
--------------
    trunk/dports/security/gpg-agent/Portfile

Added Paths:
-----------
    trunk/dports/security/gpg-agent/files/patch-agent_agent.h-strndup-compat-10.6.diff

Modified: trunk/dports/security/gpg-agent/Portfile
===================================================================
--- trunk/dports/security/gpg-agent/Portfile	2014-11-13 15:27:08 UTC (rev 128107)
+++ trunk/dports/security/gpg-agent/Portfile	2014-11-13 15:27:13 UTC (rev 128108)
@@ -60,6 +60,10 @@
     configure.cflags-append -F/System/Library/Frameworks/CoreFoundation.framework \
                             -D__APPLE_LAUNCHD__
 
+    if {${os.major} < 11} {
+        patchfiles-append   patch-agent_agent.h-strndup-compat-10.6.diff
+    }
+
     if { [tbool startupitem.install] } {
         notes-append "
                        A startup item has been installed that will aid in

Added: trunk/dports/security/gpg-agent/files/patch-agent_agent.h-strndup-compat-10.6.diff
===================================================================
--- trunk/dports/security/gpg-agent/files/patch-agent_agent.h-strndup-compat-10.6.diff	                        (rev 0)
+++ trunk/dports/security/gpg-agent/files/patch-agent_agent.h-strndup-compat-10.6.diff	2014-11-13 15:27:13 UTC (rev 128108)
@@ -0,0 +1,33 @@
+--- agent/agent.h.orig
++++ agent/agent.h
+@@ -35,6 +35,30 @@
+ #include "../common/sysutils.h" /* (gnupg_fd_t) */
+ #include "../common/session-env.h"
+ 
++
++/* strndup is not available on 10.6 and below, define a compat version here. */
++/* shameless copy from libiberty. */
++#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
++#include <stddef.h>
++#include <string.h>
++#include <stdlib.h>
++
++static inline char *strndup (const char *s, size_t n) {
++  char *result;
++  size_t len = strlen (s);
++
++  if (n < len)
++    len = n;
++
++  result = (char *) malloc (len + 1);
++  if (!result)
++    return 0;
++
++  result[len] = '\0';
++  return (char *) memcpy (result, s, len);
++}
++#endif
++
+ /* To convey some special hash algorithms we use algorithm numbers
+    reserved for application use. */
+ #ifndef GCRY_MODULE_ID_USER
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20141113/202ae3d0/attachment.html>


More information about the macports-changes mailing list