[29531] trunk/dports/games/fortune

source_changes at macosforge.org source_changes at macosforge.org
Thu Sep 27 04:36:07 PDT 2007


Revision: 29531
          http://trac.macosforge.org/projects/macports/changeset/29531
Author:   afb at macports.org
Date:     2007-09-27 04:36:06 -0700 (Thu, 27 Sep 2007)

Log Message:
-----------
fix crash with regexp (from astifter in #12716)

Modified Paths:
--------------
    trunk/dports/games/fortune/Portfile
    trunk/dports/games/fortune/files/patch-fortune-Makefile
    trunk/dports/games/fortune/files/patch-fortune.c

Modified: trunk/dports/games/fortune/Portfile
===================================================================
--- trunk/dports/games/fortune/Portfile	2007-09-27 07:34:38 UTC (rev 29530)
+++ trunk/dports/games/fortune/Portfile	2007-09-27 11:36:06 UTC (rev 29531)
@@ -4,7 +4,7 @@
 
 name			fortune
 version			4.6.2-RELEASE
-revision		8
+revision		9
 categories		games
 maintainers		nomaintainer at macports.org
 description		Infamous electronic fortune-cookie generator

Modified: trunk/dports/games/fortune/files/patch-fortune-Makefile
===================================================================
--- trunk/dports/games/fortune/files/patch-fortune-Makefile	2007-09-27 07:34:38 UTC (rev 29530)
+++ trunk/dports/games/fortune/files/patch-fortune-Makefile	2007-09-27 11:36:06 UTC (rev 29531)
@@ -5,8 +5,9 @@
  
  PROG=	fortune
 -MAN=	fortune.6
+-CFLAGS+=-DDEBUG -Wall -I${.CURDIR}/../strfile
 +MAN6=	fortune.6
- CFLAGS+=-DDEBUG -Wall -I${.CURDIR}/../strfile
++CFLAGS+=-DDEBUG -DREGCOMP -Wall -I${.CURDIR}/../strfile
  DPADD=	${LIBCOMPAT}
 -LDADD=	-lcompat
 +LDADD=	-LXXPREFIX/lib -lcompat

Modified: trunk/dports/games/fortune/files/patch-fortune.c
===================================================================
--- trunk/dports/games/fortune/files/patch-fortune.c	2007-09-27 07:34:38 UTC (rev 29530)
+++ trunk/dports/games/fortune/files/patch-fortune.c	2007-09-27 11:36:06 UTC (rev 29531)
@@ -1,11 +1,50 @@
---- fortune/fortune.c.orig	Tue Oct  8 17:16:06 2002
-+++ fortune/fortune.c	Tue Oct  8 17:16:21 2002
-@@ -204,7 +204,7 @@
+--- fortune/fortune.c.orig	2001-07-02 02:35:27.000000000 +0200
++++ fortune/fortune.c	2007-09-15 12:21:05.000000000 +0200
+@@ -169,6 +169,14 @@
  #endif
  
+ #ifndef NO_REGEX
++#ifdef REGCOMP
++#include <regex.h>
++# define	RE_COMP(p)	(regcomp(&Re_pat, (p), REG_EXTENDED))
++# define	BAD_COMP(f)	((f) != NULL)
++# define	RE_EXEC(p)	(!regexec(&Re_pat, (p), NULL, NULL, NULL))
++
++regex_t  Re_pat;
++#else
+ #ifdef REGCMP
+ # define	RE_COMP(p)	(Re_pat = regcmp(p, NULL))
+ # define	BAD_COMP(f)	((f) == NULL)
+@@ -184,6 +192,7 @@
+ 
+ #endif
+ #endif
++#endif
+ 
+ int
+ main(ac, av)
+@@ -204,7 +213,7 @@
+ #endif
+ 
  	init_prob();
 -	srandomdev();
 +	srandom(getpid());
  	do {
  		get_fort();
  	} while ((Short_only && fortlen() > SLEN) ||
+@@ -388,11 +397,15 @@
+ 		if (ignore_case)
+ 			pat = conv_pat(pat);
+ 		if (BAD_COMP(RE_COMP(pat))) {
++#ifdef REGCOMP
++			fprintf(stderr, "bad pattern: %s\n", pat);
++#else
+ #ifndef REGCMP
+ 			fprintf(stderr, "%s\n", pat);
+ #else	/* REGCMP */
+ 			fprintf(stderr, "bad pattern: %s\n", pat);
+ #endif	/* REGCMP */
++#endif	/* REGCOMP */
+ 		}
+ 	}
+ # endif	/* NO_REGEX */

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070927/61be5f55/attachment.html


More information about the macports-changes mailing list