From 73c62a430be778f4a8a94f07a9f0548b3ce4eb35 Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Mon, 7 Jan 2013 18:20:19 +0000 Subject: [PATCH] check for the right magic_version() --- src/file.c | 7 ++++++- src/magic.c | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/file.c b/src/file.c index 251a6a04..d9180bc8 100644 --- a/src/file.c +++ b/src/file.c @@ -32,7 +32,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: file.c,v 1.147 2012/10/31 14:01:28 christos Exp $") +FILE_RCSID("@(#)$File: file.c,v 1.148 2012/11/21 16:27:39 christos Exp $") #endif /* lint */ #include "magic.h" @@ -276,6 +276,11 @@ main(int argc, char *argv[]) if (e) return e; + if (MAGIC_VERSION != magic_version()) + (void)fprintf(stderr, "%s: compiled magic version [%d] " + "does not match with shared library magic version [%d]\n", + progname, MAGIC_VERSION, magic_version()); + switch(action) { case FILE_CHECK: case FILE_COMPILE: diff --git a/src/magic.c b/src/magic.c index 14cd1547..4e36ec4e 100644 --- a/src/magic.c +++ b/src/magic.c @@ -33,7 +33,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: magic.c,v 1.76 2012/10/30 23:11:51 christos Exp $") +FILE_RCSID("@(#)$File: magic.c,v 1.77 2012/10/31 17:20:06 christos Exp $") #endif /* lint */ #include "magic.h" @@ -477,3 +477,9 @@ magic_setflags(struct magic_set *ms, int flags) ms->flags = flags; return 0; } + +public int +magic_version(void) +{ + return MAGIC_VERSION; +} -- 2.40.0