Explorar o código

workaround for older platforms like Solaris < 10 where REG_STARTEND is not existing

Ralf S. Engelschall %!s(int64=18) %!d(string=hai) anos
pai
achega
52a725b96e
Modificáronse 2 ficheiros con 31 adicións e 5 borrados
  1. 30 4
      file/file.patch
  2. 1 1
      file/file.spec

+ 30 - 4
file/file.patch

@@ -1,11 +1,37 @@
 Index: src/apprentice.c
---- src/apprentice.c.orig	2006-03-02 23:08:57.000000000 +0100
-+++ src/apprentice.c	2006-09-19 13:19:42.234166634 +0200
-@@ -386,6 +386,7 @@
- 		file_oomem(ms);
+--- src/apprentice.c.orig	2007-01-19 20:54:39 +0100
++++ src/apprentice.c	2007-03-03 18:03:23 +0100
+@@ -533,6 +533,7 @@
+ 		file_oomem(ms, maxmagic * sizeof(*marray));
  		return -1;
  	}
 +	memset(marray, 0, maxmagic * sizeof(*marray));
  	marraycount = 0;
  
  	/* print silly verbose header for USG compat. */
+Index: src/softmagic.c
+--- src/softmagic.c.orig	2007-01-18 06:45:35 +0100
++++ src/softmagic.c	2007-03-03 18:16:35 +0100
+@@ -1523,10 +1523,22 @@
+ 		}
+ 		else {
+ 			regmatch_t pmatch[1];
++#ifdef REG_STARTEND
+ 			pmatch[0].rm_so = 0;
+ 			pmatch[0].rm_eo = ms->search.s_len;
+ 			rc = regexec(&rx, (const char *)ms->search.s,
+ 			    1, pmatch, REG_STARTEND);
++#else
++			char *search;
++			if (ms->search.s[ms->search.s_len] == '\0')
++				rc = regexec(&rx, (const char *)ms->search.s, 1, pmatch, 0);
++			else {
++				search = strdup(ms->search.s);
++				search[ms->search.s_len] = '\0';
++				rc = regexec(&rx, (const char *)search, 1, pmatch, 0);
++				free(search);
++			}
++#endif
+ 			switch (rc) {
+ 			case 0:
+ 				ms->search.s += (int)pmatch[0].rm_so;

+ 1 - 1
file/file.spec

@@ -37,7 +37,7 @@ Class:        BASE
 Group:        Filesystem
 License:      BSD
 Version:      %{V_api_c}
-Release:      20070302
+Release:      20070303
 
 #   package options
 %option       with_perl  no