From 9b6ada8a20d69bec0ced9ef5f5ff5004c4a142db Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Wed, 6 Mar 2013 02:57:02 +0000 Subject: [PATCH] maintain the current flip value on recursive calls unless you encounter another ^. From Toby Peterson --- src/softmagic.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/softmagic.c b/src/softmagic.c index 6770a5b9..4f99b627 100644 --- a/src/softmagic.c +++ b/src/softmagic.c @@ -32,7 +32,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: softmagic.c,v 1.162 2013/02/27 00:27:15 christos Exp $") +FILE_RCSID("@(#)$File: softmagic.c,v 1.163 2013/02/27 16:58:32 christos Exp $") #endif /* lint */ #include "magic.h" @@ -1735,9 +1735,8 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m, sbuf = m->value.s; if (*sbuf == '^') { sbuf++; - flip = 1; - } else - flip = 0; + flip = !flip; + } if (file_magicfind(ms, sbuf, &ml) == -1) { file_error(ms, 0, "cannot find entry `%s'", sbuf); return -1; -- 2.40.0