[138310] trunk/dports/security/policykit

devans at macports.org devans at macports.org
Sun Jul 5 09:44:05 PDT 2015


Revision: 138310
          https://trac.macports.org/changeset/138310
Author:   devans at macports.org
Date:     2015-07-05 09:44:04 -0700 (Sun, 05 Jul 2015)
Log Message:
-----------
policykit: patch to fix build on SL and earlier (#48245).

Modified Paths:
--------------
    trunk/dports/security/policykit/Portfile

Added Paths:
-----------
    trunk/dports/security/policykit/files/patch-getline.diff

Modified: trunk/dports/security/policykit/Portfile
===================================================================
--- trunk/dports/security/policykit/Portfile	2015-07-05 13:03:32 UTC (rev 138309)
+++ trunk/dports/security/policykit/Portfile	2015-07-05 16:44:04 UTC (rev 138310)
@@ -36,7 +36,8 @@
 
 gobject_introspection yes
 
-patchfiles          patch-configure.ac.diff
+patchfiles          patch-configure.ac.diff \
+                    patch-getline.diff
 
 pre-patch {
     if {${os.platform} eq "darwin" && ${os.major} < 10} {

Added: trunk/dports/security/policykit/files/patch-getline.diff
===================================================================
--- trunk/dports/security/policykit/files/patch-getline.diff	                        (rev 0)
+++ trunk/dports/security/policykit/files/patch-getline.diff	2015-07-05 16:44:04 UTC (rev 138310)
@@ -0,0 +1,79 @@
+--- src/polkitagent/polkitagenthelperprivate.c.orig	2015-07-05 09:29:39.000000000 -0700
++++ src/polkitagent/polkitagenthelperprivate.c	2015-07-05 09:33:11.000000000 -0700
+@@ -45,6 +45,76 @@
+ }
+ #endif
+ 
++// getline() is only available on OS X Lion and newer
++
++#ifdef __APPLE__
++#include <Availability.h>
++#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060
++
++static const int line_size = 128;
++
++static ssize_t
++getdelim (char **lineptr, size_t *n, int delim, FILE *stream);
++
++static ssize_t
++getline (char **lineptr, size_t *n, FILE *stream);
++
++static ssize_t
++getdelim (char **lineptr, size_t *n, int delim, FILE *stream)
++{
++  int indx = 0;
++  int c;
++
++  /* Sanity checks.  */
++  if (lineptr == NULL || n == NULL || stream == NULL)
++    return -1;
++
++  /* Allocate the line the first time.  */
++  if (*lineptr == NULL)
++    {
++      *lineptr = malloc (line_size);
++      if (*lineptr == NULL)
++        return -1;
++      *n = line_size;
++    }
++
++  /* Clear the line.  */
++  memset (*lineptr, '\0', *n);
++
++  while ((c = getc (stream)) != EOF)
++    {
++      /* Check if more memory is needed.  */
++      if (indx >= *n)
++        {
++          *lineptr = realloc (*lineptr, *n + line_size);
++          if (*lineptr == NULL)
++            {
++              return -1;
++            }
++          /* Clear the rest of the line.  */
++          memset(*lineptr + *n, '\0', line_size);
++          *n += line_size;
++        }
++
++      /* Push the result in the line.  */
++      (*lineptr)[indx++] = c;
++
++      /* Bail out.  */
++      if (c == delim)
++        {
++          break;
++        }
++    }
++  return (c == EOF) ? -1 : indx;
++}
++
++static ssize_t
++getline (char **lineptr, size_t *n, FILE *stream)
++{
++  return getdelim (lineptr, n, '\n', stream);
++}
++#endif
++#endif
+ 
+ char *
+ read_cookie (int argc, char **argv)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150705/92092bba/attachment.html>


More information about the macports-changes mailing list