[154364] trunk/dports/audio/pianobar

ryandesign at macports.org ryandesign at macports.org
Fri Oct 28 21:26:17 CEST 2016


Revision: 154364
          https://trac.macports.org/changeset/154364
Author:   ryandesign at macports.org
Date:     2016-10-28 21:26:17 +0200 (Fri, 28 Oct 2016)
Log Message:
-----------
pianobar: Fix build failure on Snow Leopard and earlier

Modified Paths:
--------------
    trunk/dports/audio/pianobar/Portfile

Added Paths:
-----------
    trunk/dports/audio/pianobar/files/getline.patch

Modified: trunk/dports/audio/pianobar/Portfile
===================================================================
--- trunk/dports/audio/pianobar/Portfile	2016-10-28 18:50:49 UTC (rev 154363)
+++ trunk/dports/audio/pianobar/Portfile	2016-10-28 19:26:17 UTC (rev 154364)
@@ -31,6 +31,8 @@
                             port:libgcrypt \
                             port:json-c
 
+patchfiles                  getline.patch
+
 configure.cflags-append     -std=c99
 
 # Prevent upgrade failure.

Added: trunk/dports/audio/pianobar/files/getline.patch
===================================================================
--- trunk/dports/audio/pianobar/files/getline.patch	                        (rev 0)
+++ trunk/dports/audio/pianobar/files/getline.patch	2016-10-28 19:26:17 UTC (rev 154364)
@@ -0,0 +1,35 @@
+https://github.com/PromyLOPh/pianobar/issues/572
+https://gist.github.com/anonymous/ade9ed29fdcd9cbcb185a9303524c1a0
+--- src/settings.c.orig
++++ src/settings.c
+@@ -201,9 +201,8 @@ void BarSettingsRead (BarSettings_t *settings) {
+ 	for (size_t j = 0; j < sizeof (configfiles) / sizeof (*configfiles); j++) {
+ 		static const char *formatMsgPrefix = "format_msg_";
+ 		FILE *configfd;
+-		/* getline allocates these on the first run */
+-		char *line = NULL;
+-		size_t lineLen = 0, lineNum = 0;
++		char line[1024];
++		size_t lineNum = 0;
+ 
+ 		char * const path = BarGetXdgConfigDir (configfiles[j]);
+ 		assert (path != NULL);
+@@ -214,8 +213,8 @@ void BarSettingsRead (BarSettings_t *settings) {
+ 
+ 		while (1) {
+ 			++lineNum;
+-			ssize_t ret = getline (&line, &lineLen, configfd);
+-			if (ret == -1) {
++			char * const ret = fgets (line, sizeof (line), configfd);
++			if (ret == NULL) {
+ 				/* EOF or error */
+ 				break;
+ 			}
+@@ -410,7 +409,6 @@ void BarSettingsRead (BarSettings_t *settings) {
+ 
+ 		fclose (configfd);
+ 		free (path);
+-		free (line);
+ 	}
+ 
+ 	/* check environment variable if proxy is not set explicitly */
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-changes/attachments/20161028/a7f2ba6c/attachment-0002.html>


More information about the macports-changes mailing list