From 7f70bb42188dbf3f6b4898441bf4cfad71ba98ce Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Tue, 9 Jun 2015 22:17:52 +0000 Subject: [PATCH] - bytecnt needs to be adjusted by offset - always return true from mget() regardless if match() matched. Fixes mime printing where we stopped matching the use magic because match return 0, since if (print) *returnval = 1; did not execute for mime. --- src/softmagic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/softmagic.c b/src/softmagic.c index 9608b968..15a092f0 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.215 2015/05/21 18:25:29 christos Exp $") +FILE_RCSID("@(#)$File: softmagic.c,v 1.216 2015/06/09 22:17:52 christos Exp $") #endif /* lint */ #include "magic.h" @@ -1107,7 +1107,7 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir, bytecnt = nbytes - offset; buf = RCAST(const char *, s) + offset; - end = last = RCAST(const char *, s) + bytecnt; + end = last = RCAST(const char *, s) + bytecnt + offset; /* mget() guarantees buf <= last */ for (lines = linecnt, b = buf; lines && b < end && ((b = CAST(const char *, @@ -1708,7 +1708,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m, printed_something, need_separator, returnval); if (rv != 1) *need_separator = oneed_separator; - return rv; + return 1; case FILE_NAME: if (ms->flags & MAGIC_NODESC) -- 2.40.0