From: Christos Zoulas Date: Tue, 9 Jun 2015 22:17:52 +0000 (+0000) Subject: - bytecnt needs to be adjusted by offset X-Git-Tag: FILE5_23~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=91a5efbb98579b98c27dbaed01694e4bda3edc9e;p=file - 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. --- diff --git a/src/softmagic.c b/src/softmagic.c index eccd190a..f38d6fc3 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.214 2015/04/09 20:01:41 christos Exp $") +FILE_RCSID("@(#)$File: softmagic.c,v 1.215 2015/05/21 18:25:29 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)