Submitted By: Matt Burgess (matthew at linuxfromscratch dot org) Date: 2007-03-04 Initial Package Version: 4.20 Origin: ftp://ftp.gw.com/mirrors/pub/unix/file/Upstream/patch-4.20-REG_STARTEND Upstream Status: Applied Description: Fixes a bug caused by an undefined constant diff -Naur file-4.20.orig/src/softmagic.c file-4.20/src/softmagic.c --- file-4.20.orig/src/softmagic.c 2007-01-18 05:45:35.000000000 +0000 +++ file-4.20/src/softmagic.c 2007-03-04 10:19:57.000000000 +0000 @@ -38,7 +38,7 @@ #ifndef lint -FILE_RCSID("@(#)$File: softmagic.c,v 1.91 2007/01/18 05:29:33 ljt Exp $") +FILE_RCSID("@(#)$File: softmagic.c,v 1.95 2007/03/03 19:09:25 christos Exp $") #endif /* lint */ private int match(struct magic_set *, struct magic *, uint32_t, @@ -1523,10 +1523,20 @@ } else { regmatch_t pmatch[1]; +#ifndef REG_STARTEND +#define REG_STARTEND 0 + size_t l = ms->search.s_len - 1; + char c = ms->search.s[l]; + ((char *)(intptr_t)ms->search.s)[l] = '\0'; +#else pmatch[0].rm_so = 0; pmatch[0].rm_eo = ms->search.s_len; +#endif rc = regexec(&rx, (const char *)ms->search.s, 1, pmatch, REG_STARTEND); +#if REG_STARTEND == 0 + ((char *)(intptr_t)ms->search.s)[l] = c; +#endif switch (rc) { case 0: ms->search.s += (int)pmatch[0].rm_so;